# Need a vlookup formula to compare 2 different columns from 2 different work sheets in the same .xlsx. Where field values match copy a value from one sheet to the other.

Looking to use VLOOKUP to compare two different columns from two different sheets for matching value, and where value matches in Sheet A Column A and Sheet B Column A, copy values from Sheet B Column B to Sheet A Column B.

So.

Example.xlsx

Where value in column A matches B.

SheetA           SheetB                                        SheetA becomes
Column A       Column A Column B                  Column A Column B
1                       2                Yes                              1
2                       3                No                               2                 Yes
3                       5                No                               3                 No
4                       0                Maybe                        4

Formula I tried.
=VLOOKUP(\$A\$2,SheetB!A2:A4585,2,FALSE)

No matter what i try i cannot get it to reference a value correctly in SheetB, even though I know there is one that matches \$A\$2 from SheetA.
###### Who is Participating?

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:
Hi,
Try this function =IFERROR(VLOOKUP(A2,SheetB!A:B,2,0),"")

In your function you set the value of column Index as 2 while you have only 1 column in Lookup table which is A, so your function won't return result you can change your function to be :
=VLOOKUP(A2,SheetB!\$A\$2:\$B\$4585,2,FALSE)
Author Commented:
Hi, Thanks for the response!

The way I understood it was the "2" value was the column data I was looking to copy over from column 2 table B to table A column 2 if there was a match for A2 somewhere on SheetB.

When I run the formula through error checker in Excel I get the correct value for A2, and it picks up SheetB and its values, but still get a ref error when running the final step.

I tried your formula but am not getting any data back.
Commented:
Hi,
Check the attached file and if it's not enough to solve the issue, please share workbook with dummy data that contains the error you got so we can clear it out.
VLookupEE.xlsx
###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.