简体   繁体   English

在Excel中使用Vlookup函数时出错

[英]Error using Vlookup function in Excel

I have the following data set: 我有以下数据集:

在此输入图像描述

I calculate the maximum return using =max(B2:B13) in cell D3 (ie, 13.55%), and then I would like to find the date where this maximum return was realized. 我在单元格D3使用=max(B2:B13)计算最大回报(即13.55%),然后我想找到实现最大回报的日期。 Thus, I use =vlookup(D3;A2:B13;1;FALSE) , and I get as a result #N/A , which is clearly wrong. 因此,我使用=vlookup(D3;A2:B13;1;FALSE) ,我得到的结果是#N #N/A ,这显然是错误的。 How can I make this work? 我怎样才能做到这一点?

You can't use a VLOOKUP to find a value that isn't in the first column of your data table. 您不能使用VLOOKUP查找不在数据表第一列中的值。 Use an INDEX/MATCH formula instead: 改为使用INDEX / MATCH公式:

=INDEX(A2:A13,MATCH(MAX(B2:B13),B2:B13,0))

A VLOOKUP is a V ertical Lookup - and is used to look up a value in the first column of a table and return a corresponding value from another column in that table (just like looking at a timetable for example). 甲VLOOKUP是V ertical 查询 -并且用于查找值表中的第一列和从另一列在该表返回一个对应的值(就像看例如时间表)。

You are trying to find the max value from column B, in column A - where it doesn't exist so you're not going to find it. 您正试图在A列中找到B列的最大值 - 它不存在,因此您无法找到它。 In order to use a VLOOKUP the lookup_value must be in the first column of the data table. 为了使用VLOOKUP, lookup_value 必须位于数据表的第一列。

If you want to look up a value in another column of the data table, then you need to use =INDEX(MATCH()) instead. 如果要在数据表的另一列中查找值,则需要使用=INDEX(MATCH())

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

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