Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Match name and copy row from sheet 1 to sheet 2 on corresponding column

I asked a very similar question to this one here, but I am trying to identify if a cell's numerical value is contained in a list of cells on a different sheet. If the cell from sheet A matches a cell in sheet B, mark a different column in B with a corresponding row in sheet A, otherwise leave it blank. An example is below:

Sheet A

Column A | Column B
-------------------
   1        John
   2        Sue
   4        Bob

I would like the corresponding Sheet B to populate Column B like this:

Sheet B

Column A | Column B
-------------------
   2         Sue
   3        
   4         Bob

=IF(ISNUMBER(MATCH(I2, 'SALT, WOD, Champion Members'!A:A, 0)), "Y", "N")

I have been using the above answer to populate a different column in the same workbook, and I'm thinking I can maybe use this formula, but instead of "Y" or "N", somehow preserve the row.

like image 504
ngwilliams Avatar asked Oct 03 '22 13:10

ngwilliams


2 Answers

You need to use VLOOKUP as already mentioned. But you will need to use another function to check for existence of the value, else you will get #N/A against ID 3

I used COUNTIF

=IF(COUNTIF($A$2:$A$4,E2)=0,"",VLOOKUP(E2,$A$2:$B$4,2,FALSE))

VLOOKUP

like image 103
Sam Avatar answered Oct 13 '22 10:10

Sam


Use the VLOOKUP function:

=VLOOKUP(A1;Sheet1!A:B;2;FALSE)

Where A1 is the value you want to look up, Sheet1!A:B is the original sheet with the data.

like image 34
littleimp Avatar answered Oct 13 '22 11:10

littleimp