简体   繁体   中英

Compare two columns of two excels and return 3rd column

I want to compare two columns of two different Excel sheets and return the corresponding 3rd column value of 2nd excel sheet infront of corresponding matched rows of 1st excel sheet.

Suppose Excel 1 contains follow value

Sl.No   Count
-------------------------------
105       1  
106       2  
107       3  
108       4  
109       5  
110       6  

Excel 2 contain

Sl.No   Count   Grade
-----------------------
108       4       A  
109       5       B  
110       6       C  
111       1       D  

Expected result

Sl.No   Count   Grade
-------------------------
105       1  
106       2 
107       3 
108       4       A  
109       5       B  
110       6       C  

Please suggest, what function should I use.

Thanks in Advance.

Use this formula:

=IFERROR(IF(VLOOKUP(A2,'Excel 2'!$A$2:$B$1000,2,FALSE)=B2,VLOOKUP(A2,'Excel 2'!$A$2:$C$1000,3, FALSE),""),"")

Put it into Cell C2 in your first sheet and fill down.

Another formula option is below. A bit cleaner, but it's an array formula, so processing may be slower with large data sets.

=IFERROR(INDEX(Sheet2!C:C,MATCH(A1&B1,Sheet2!A:A&Sheet2!B:B,0)),"")

It's an array formula, so be sure to press Ctrl + Shift + Enter when exiting edit mode. If done right, excel will wrap curly brackets around the formula.

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