简体   繁体   中英

Check if value contains in another column and then get value based on that (Excel)

I have three columns in Excel sheet. For example:

在此处输入图像描述

Now what I want to achieve is that when ID in D column matches ID in A column, then VALUE in B column is copied to E column next to matching ID.

For example: ID 4 (in D column) should have value 11 (in E column [E2]) ID 7 (in D column) should have value 77 (in E column [E6])

Use INDEX and MATCH . Type this formula into E2 and drag it down:

=INDEX($B$2:$B$9,MATCH(D2,$A$2:$A$9,0))

MATCH will look up the row number in column A and INDEX delivers the corresponding value from column B.

So I solved this. I used the following formula in E cell:

=LOOKUP(D2,$A$2:$A$9,$B$2:$B$9)

and then I dragged this all the way to the end of E column (E9)

You could use the below:

=IFERROR(VLOOKUP(D2,$A$2:$B$9,2,0),"Value not found")

In case of missing value you will get Value not found

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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