excel - 根据月份和年份查找单元格的值
问题描述
如果我不清楚你,我很抱歉。
我有例如:
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、...
推荐阅读
- ms-access - 如何通过(无限)添加按钮在主窗体中制作系列子窗体?
- ruby-on-rails - Ruby OAuth2.0:客户端凭据类型具有不受支持的客户端身份验证方法
- hadoop - Impala : 运行总和 1 小时
- php - 如何在我的数组 codeigniter 中添加翻译到“名称”字段?
- javascript - 如何将标志添加到计数更新角度高位图
- javascript - 如何在文件中添加时间戳
- c# - 如何重构代码以删除 C# 应用程序中的 break 语句
- android - android.view.InflateException: Binary XML file line #132: Binary XML file line #132: Error inflating class Button
- django - 空 Django 表单选择字段
- c# - 无法让我的简单洛伦兹因子计算器处理小数。我错过了什么?