Pr0no
Pr0no

Reputation: 4109

How to fill cells from sheet A with values from sheet B when ID matches (in Excel)?

Consider the following 2 sheets. Sheet AAA has a list of companies with an emptry column ROA. Sheet BBB has a ROA value for some of these companies.

Sheet AAA

    A    B
1  ID   ROA
2   1
3   2
4   3
5   4

Sheet BBB

    A    B
1  ID   ROA
2   1   60.40
3   3   10.10
4   4    9.00

Looking at the ID in both sheets, I need a formula to fill in column AAA.B, resulting in

    A    B
1  ID   ROA
2   1   60.40
3   2
4   3   10.10
5   4    9.00

What formula do I need in cell AAA.B2 (and down) to get this done? I believe VLOOKUP is the function appropriate here, but I am unsure as how to use it in this case?

Upvotes: 1

Views: 549

Answers (1)

Mark PM
Mark PM

Reputation: 2919

Use the LOOKUP function with MATCH and ISNA:

=IF(ISNA(MATCH(A1,Sheet2!$A$1:$A$3,0)),"",LOOKUP(A1,Sheet2!$A$1:$A$3,Sheet2!$B$1:$B$3))

Upvotes: 1

Related Questions