gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 03:58:38 25 4
gpt4 key购买 nike

如果我对您不清楚,请提前致歉。

我有例如:

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

关于excel - 根据月份和年份查找单元格的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63464511/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com