# Solved: Excel comparing 2 columns

Discussion in 'Business Applications' started by Bsoda, Jun 23, 2011.

Not open for further replies.

Joined:
Jun 23, 2011
Messages:
2
I have a spreadsheet that I wish to compare 2 columns and bring the information from the 3rd. For example, if A6 is equal to an item in G1:G98, then the number in B6 should equal the corresponding number in H1:h98. The formula I used is =VLOOKUP(A8,\$G\$1:\$H\$98,2,FALSE) It works great except the problem I have is sometimes there is no corresponding value in G1:G98. In that case I would like it to enter the number 0.

2. ### Yorkshire Guy

Joined:
Dec 9, 2003
Messages:
563
Hi Bsoda,

=IF(ISERROR(VLOOKUP(A8,\$G\$1:\$H\$98,2,FALSE)),0,(VLOOKUP(A8,\$G\$1:\$H\$98,2,FALSE)))

lol
Hew

(looking at what I just posted, its displaying an extra space in the final FALSE, but its not there when I go to Edit it!!)

Joined:
Jun 23, 2011
Messages:
2
Thank you! It worked great!

4. ### Yorkshire Guy

Joined:
Dec 9, 2003
Messages:
563
hi Bsoda,

That's great, you are welcome.

lol
Hew

As Seen On