根据月份和年份查找单元格的值

Find value of a cell according to month and year

如有不明之处,敬请见谅

我有例如:

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...