Understanding the vlookup formula in Excel?

醉酒当歌 提交于 2019-12-12 00:27:39

问题


I have two lists in the spreadsheet and some of the names match and some do not.

I need a formula so that where the text matches it can assign the corresponding value.

For example: in B2 it would read a 0 or false because there is no Jimmy T. in the C column. However, in B3 the formula should work as if the text in A3 matches any text in the C column it assigns the corresponding D value that is directly to the right. So, in B3 the answer would be 47.33.

The ultimate goals is for the value in the B column to correspond with Column A the same way that column C corresponds with column D.
And where there is not a value for column A to have it read "False" in column B.


回答1:


Type on B2:

=VLOOKUP(A2,$C$2:$D$7,2,FALSE)

then, drag the formula down to the other cells on column B. The vlookup formula has four arguments (see explanation below).

To have the word "False" appearing where no match is found upgrade to the following formula:

=IFERROR(VLOOKUP(A2,$C$2:$D$7,2,FALSE),"False")

This is a example about the above formula's output.

Basically, what the vlookup function does is:

  1. to find a match for the specified cell (first formula argument),
  2. given an array of values (second argument). The leftmost column in the array must have the values to be matched with the formula's first argument),
  3. and if there is a match it returns the values from one specific column of this array (third formula argument). In the above example we want to return the second column of the specified array.
  4. The last argument on the vlookup formula returns the value for an approximate match (TRUE) or for an exact match (FALSE).


来源:https://stackoverflow.com/questions/20892028/understanding-the-vlookup-formula-in-excel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!