Find the value from one cell, copy the value from the cell next to this cell and paste it onto another sheet

I have 2 sheets with different values. I need to find the value from one cell .sheet1 in sheet2 and copy the value from nextcell_in_the_same_row.sheet1 to nextcell_in_the_same_row.sheet2. It is very difficult to explain, let's look at an example below.

eg. Front

first sheet: AB 1 aaa 123 2 bbb 456 3 ccc 789 4 ddd 122 second sheet: AB 1 aaa 2 ada 3 cca 4 ccc 

After

 first sheet: AB 1 aaa 123 2 bbb 456 3 ccc 789 4 ddd 122 second sheet: AB 1 aaa *need to find value in the first sheet and copy value from B2 because aaa in A1* 2 ada *value does not exist in the first sheet so copy nothing* 3 cca *not need to copy because no value in the first sheet* 4 ccc *need to copy the value from B3* 

Thank you very much!

+1
source share
1 answer

Use VLOOKUP with IFERROR .

 =IFERROR(VLOOKUP(A1, Sheet1!A:B, 2, 0), "") 

This will do what you described (well described, by the way!) In your question. Drag the formula down in Sheet2 to the bottom.

VLOOKUP takes the value A1 in sheet 2 (without reference to the sheet, because the value is on the same sheet as the formula) and looks at it in column A Sheet1 .

Returns the second value (therefore, why 2 ) of the table selected in the formula (column A is 1, column B is 2).

0 tells VLOOKUP to search for exact matches. Here you do not need an approximate match.

And IFFERROR exists if VLOOKUP does not find anything (for example, with ada ) and instead of providing #N/A returns an empty cell "" .

+4
source

Source: https://habr.com/ru/post/951572/


All Articles