问题描述
如果您不清楚我的事,敬请谅解。
例如,我有:
figure 1 :
| A | B |
|01/05/2019| 500 |
|01/07/2020| -100000 |
|01/12/2020| 7633 |
和
figure 2 :
| A | B |
|01/05/2019| -0.3521 |
|01/07/2020| 0.455 |
|01/12/2020| 0 |
我想在图1的B列的公式中包含与图2的A列相关的月份和年份的值(在图1的A列中找到日期),请记住日子不一样了。
谢谢。
解决方法
我建议您使用帮助列,其中包含有关月份和年份的唯一信息。问题是,您将如何做?我提出以下公式:
Helper(date) = 12*Year(date) + Month(date)
其中Year()
和Month()
是用于检索日期的年数和月数的基本Excel函数。使用这种方法,然后可以使用VLookup()
函数来查找所需的列,例如:
Figure1:
========
Helper | A | B |
24233 | 01/05/2019 | 500 |
24247 | 01/07/2020 | -100000 |
24252 | 01/12/2020 | 7633 |
Figure2: (with some modification,I used the second day of the month to clarify
======== the correctness of the provided formula)
Helper | A | B |
24233 | 02/05/2019 | -0.3521 |
24247 | 02/07/2020 | 0.455 |
24252 | 02/12/2020 | 0 |
如您所见,简单的VLookup()
可用于搜索值24233、24247、24252,...