使用 Excel 匹配结果作为列选择
我有一个 MATCH 表达式,它返回有效的行号。
我现在需要将此结果与已知的列标识符结合起来以返回该单元格的结果。
因此,如果 A50
上的内容 = "apple"
,那么我就可以获得单元格 D50
的内容。
我查看了 INDIRECT 和 INDEX ,但我没有看到它有什么帮助。
答案:
=INDEX('SHEET1'!A:D,MATCH(SHEET2!A2,'SHEET1'!B:B,0),4)
我让 INDEX
开始工作。需要更多的阅读时间。
'SHEET1'!A:D
是 INDEX
使用的范围。
MATCH(SHEET2!A2,'SHEET1'!B:B,0)
正在根据我的 MATCH
标准拉取该行。
4
是使用上面 MATCH
中的行编号返回单元格内容的列。
希望这能帮助其他人了解如何使用 INDEX
。
I have a MATCH
expression that returns the valid row number.
I now need to combine this result with a known Column identifier to return the results of that cell.
So, if something on A50
= "apple"
, then I can get the contents of cell D50
.
I looked at INDIRECT
and INDEX
, but I'm not seeing how it can help.
Answer:
=INDEX('SHEET1'!A:D,MATCH(SHEET2!A2,'SHEET1'!B:B,0),4)
I got INDEX
to work. It took some more reading up on it.
'SHEET1'!A:D
is the range for INDEX
to work with.
MATCH(SHEET2!A2,'SHEET1'!B:B,0)
is pulling the row based upon my MATCH
criteria.
4
is the column to return the cell contents from using the row number from the MATCH
above.
Hopefully this will help someone else understand how to use INDEX
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
=INDEX('SHEET1'!A:D,MATCH(SHEET2!A2,'SHEET1'!B:B,0),4)
我让 INDEX 工作。又读了一些书。
'SHEET1'!A:D 是 INDEX 使用的范围。 MATCH(SHEET2!A2,'SHEET1'!B:B,0) 正在根据我的 MATCH 标准拉动该行。 4 是使用上面 MATCH 中的 ROW 编号返回单元格内容的 COLUMN。
然而,给出的其他选项也非常有帮助。
=INDEX('SHEET1'!A:D,MATCH(SHEET2!A2,'SHEET1'!B:B,0),4)
I got INDEX to work. Took some more reading up on it.
'SHEET1'!A:D is the range for INDEX to work with. MATCH(SHEET2!A2,'SHEET1'!B:B,0) is pulling the row based upon my MATCH criteria. 4 is the COLUMN to return the cell contents from using the ROW number from the MATCH above.
However, the other options given were very helpful as well.
尝试一下 VLOOKUP。例如,
这是一个非常有用的功能。
Give VLOOKUP a try. For example,
It's a very useful function.
间接允许您通过使用动态值指定其位置来引用工作表中的任意单元格。在您的情况下,您需要执行以下操作:
这将返回您给出的示例中单元格 D50 的值。 Excel 文档称它返回对该单元格的“引用”,但实际上它会立即计算为单元格的值。
与 VLOOKUP 相比,此方法的主要优点是 INDIRECT 将引用任意单元格,而 VLOOKUP 需要已知的数据范围和匹配值。例如,如果您的
MATCH
条件引用了您要提取的数据中的另一张工作表,则最佳选择是INDIRECT
。INDIRECT allows you to refer to any arbitrary cell in the sheet by specifying its location using a dynamic value. In your case, you'll want to do something like this:
That will return the value of the cell D50 in the example you've given. The Excel documentation says it returns a "reference" to that cell, but in reality it's immediately evaluated to the cell's value.
The main benefit of this approach over
VLOOKUP
is thatINDIRECT
will refer to any arbitrary cell, whereasVLOOKUP
requires a known data range and a matching value. For example, if yourMATCH
criteria references another sheet from the data you want to pull, your best option isINDIRECT
.