简体   繁体   English

如何使用vlookup搜索单元格值而不是其单元格引用公式(Excel)

[英]How to use vlookup to search for a cell value rather than its cell reference formula(Excel)

I'm trying to use the excel vlookup function to search for values in a table which is created using references to other cells in other sheets. 我正在尝试使用excel vlookup函数在使用对其他工作表中其他单元格的引用创建的表中搜索值。 Each cells searched has a reference to other cell in another sheet, as shown in red below: 每个搜索到的单元格都有另一个工作表中其他单元格的引用,如下红色所示:

用于查找灰狗统计数据的表

In this table, i named the table as statistics and, for test, i named greyhound runs as the same. 在此表中,我将该表命名为Statistics,并且为了进行测试,我将greyhound命名为相同。 I also created other sheet for looking up for greyhound stats as shown below: 我还创建了其他表格来查找灰狗的统计信息,如下所示:

VLookUp工作表

However, when i use Vlookup (PROCV in portuguese) to search in the greyhound column, i get a "value not available" error message (also in portuguese), as you can see on the image. 但是,当我使用Vlookup(葡萄牙语中的PROCV)在灵狮栏中搜索时,我收到一条“值不可用”错误消息(也在葡萄牙语中),如您在图像上看到的。

So, how can i get the greyhound data by its name, which is in fact just referenced by the cell and isn't really there? 那么,我怎样才能通过它的名字得到灵缇数据呢?实际上,它只是被单元引用,实际上并没有在那里?

VLOOKUP is your real problem here :D VLOOKUP是您真正的问题在这里:D

But, assuming that you want to use VLOOKUP, you've defined your ranges wrong, and @nutsch is correct: 但是,假设您要使用VLOOKUP,则错误地定义了范围,而@nutsch是正确的:

=VLOOKUP(B1,Sheet1!A:H,2,FALSE)

or 要么

=VLOOKUP(B1,[Statistics],2,FALSE)

if [Statistics] is defined as the entire table. 如果[统计]被定义为整个表格。 You must use "2" to call for the "runs" because that's how VLOOKUP works (it counts the number of Columns in the array you define - it doesn't care what you name things). 您必须使用“ 2”来调用“运行”,因为这是VLOOKUP的工作方式(它计算您定义的数组中的列数-不在乎您为什么命名)。

Now, say you're tired of using column numbers and you WANT to use your ranges. 现在,假设您已经厌倦了使用列号,并且想要使用范围。 Then we look at Index/Match. 然后我们看一下索引/匹配。

Index/Match 索引/匹配

Index() is going to help us find our answer, while Match() helps us do the matching part. Index()将帮助我们找到答案,而Match()将帮助我们完成匹配部分。 In cell TheBest!B2, you'd put: 在单元格TheBest!B2中,您应该输入:

=INDEX(Sheet1!B:B,MATCH(B1,Sheet1!A:A,0))

or 要么

=INDEX([Runs],MATCH(B1,[Greyhound],0))

if you're using named ranges (where [Greyhound] is Column A in the first screen shot and [Runs] is Column B in the same screenshot.) The 0 in the Match equation is how we find the EXACT match as well. 如果您使用的是命名范围(在同一屏幕快照中[灰狗]是第A列,[运行次数]是B列。)Match方程中的0也是我们找到精确匹配的方式。

Interestingly, I note that your output sheet is just turning the data on its side. 有趣的是,我注意到您的输出表只是在翻转数据。 You could use a PivotTable here, or you could even design a single equation that would work for all cells with Index/Match/Match. 您可以在此处使用数据透视表,甚至可以设计一个适用于所有具有索引/匹配/匹配单元格的方程式。

Index/Match/Match 索引/匹配/匹配

Index() can let you define the rows as well as the columns, so let's do that too! Index()可以让您定义行和列,所以我们也要这样做!

=INDEX(Sheet1!A1:H100,MATCH(B$1,Sheet1!A:A,0),MATCH($A2,Sheet1!1:1,0))

or, if I'm assuming that [Statistics] is the whole table and [Greyhound] is Column A and [Headers] is Row 1, 或者,如果我假设[Statistics]是整个表格,并且[Greyhound]是A列,[Headers]是第1行,

=INDEX([Statistics],MATCH(B$1,[Greyhound],0),MATCH($A2,[Headers],0))

You could drag this equation down B2:B8 on your reporting page and it should work fine, regardless of which dog is shown in B1. 您可以将此等式向下拖动到报告页面上的B2:B8上,并且无论B1中显示的是哪条狗,它都可以正常工作。

None of this should care if your Statistics array is referencing the dog name with =Top50Graded!A3. 如果您的Statistics数组使用= Top50Graded!A3引用狗名,则这些都不关心。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM