Excel 中动态列的 LOOKUP
对于 Excel 专家来说,这可能是一个非常微不足道的问题,所以我提前道歉。我花了几个小时研究这个问题,但正如 Excel 中的所有内容一样,除非是这方面的专家,否则他们可能会发现量子物理更容易。
我有一个工作簿,其中有一张工作表需要从另一张工作表中提取数据。有两个查找条件:
- 在另一张工作表上进行基于行的查找,该查找正在工作并查找相应的行。
- 在另一张工作表的相应行中,我需要根据动态列名称从该行中的单元格中获取值。因此,我有一个基于字符串的列名称(即标题;即第 1 行),并且我需要根据列的名称从中获取值。
这是我的查找代码以及我想要做的事情:(
=XLOOKUP(
// Source data for row lookup (working)
D3&H3,
// Destination data for row lookup on other sheet (working)
'Prices'!$A$2:$A$1048576 & 'Prices'!$B$2:$B$1048576,
// Not real code, but the part that I am trying to accomplish.
// The CUSTOM_COLUMN_NAME will come from either a formula or
// another cell on the given sheet, and is supposed to denote
// the column header name on the Prices sheet.
'Prices'["CUSTOM_COLUMN_NAME"]:$2$1048576
)
我提供了整个函数,以防万一有人用 VLOOKUP 或 HLOOKUP 重写它会更容易)
希望这是有道理的,并且真诚地感谢任何帮助。 。
This is probably a very trivial question for an Excel expert, so I apologize in advance. I spent hours on this, but as everything in Excel -- unless one is an expert in it they will probably find quantum physics easier.
I have a workbook with a sheet which needs to pull data from another sheet. There are two lookup criteria:
- A row-based lookup on the other sheet, which is working and finding the corresponding row.
- In the corresponding row on the other sheet, I need to grab a value from a cell in that row based on a dynamic column name. So I have a string-based name of the column (i.e. the header; i.e. row #1), and I need to grab the value from the it based on the column's name.
Here is my lookup code and what I am trying to do:
=XLOOKUP(
// Source data for row lookup (working)
D3&H3,
// Destination data for row lookup on other sheet (working)
'Prices'!$A$2:$A$1048576 & 'Prices'!$B$2:$B$1048576,
// Not real code, but the part that I am trying to accomplish.
// The CUSTOM_COLUMN_NAME will come from either a formula or
// another cell on the given sheet, and is supposed to denote
// the column header name on the Prices sheet.
'Prices'["CUSTOM_COLUMN_NAME"]:$2$1048576
)
(I provided the entire function just in case it would be easier for someone to rewrite it with VLOOKUP or HLOOKUP)
Hopefully this makes sense, and any help would be sincerely appreciated...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
下面是使用 MATCH 和 INDEX 进行二维查找的示例,它将跨工作表工作。
Here's an example of 2-d look-up using MATCH and INDEX, and it will work across sheets.