How to Use VLOOKUP to Copy Data Between Sheets Based on a Code?

happydz

Board Regular
Joined
Jan 11, 2017
Messages
63
Office Version
  1. 2010
Hello everyone,I'm currently working on an Excel project where I need to copy data from one sheet to another using the VLOOKUP function. I have two sheets:
  • Sheet1contains the following columns:
    • Column G: CODE
    • Column F: CUSTOMER
    • Column E: UNITS
I want to retrieve the CUSTOMER name based on a specific CODE. For example, when I enter the code 1001 in cell G5 of my second sheet, I want to use VLOOKUP to automatically fill in the corresponding CUSTOMER name in cell F5.Here’s the formula I tried:
F5 =RECHERCHEV(G5,Feuil1!E3:G5,2,FAUX)

However, I keep getting the #N/A error.I've checked that:
  • The CODE exists in Sheet1.
  • The range is correctly defined.
  • There are no leading or trailing spaces in the CODE or CUSTOMER fields.
I’ve attached screenshots of both sheets for reference. Any help or suggestions on how to resolve this issue would be greatly appreciated!Thank you in advance for your assistance!
 

Attachments

  • sheet 1.JPG
    sheet 1.JPG
    65.8 KB · Views: 12
  • sheet2.JPG
    sheet2.JPG
    58.8 KB · Views: 11

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
It sounds like your problem may be with the range you are referencing. The range in your VLOOKUP should start with the column with the lookup value (CODE in Column G) and include the CUSTOMER column. Try updating your thread:
=VLOOKUP(G5,Sheet1!G3:F100,2,FALSE)
If this still doesn’t work, make sure your CODE column is formatted exactly the same on both documents (e.g. as text or numbers). When I had a similar problem, the SkySuite AI was quick to flag formatting inconsistencies I had overlooked and suggested corrections.
 
Upvote 0
Are you still using 2010 version of excel
F5 =RECHERCHEV(G5,Feuil1!E3:G5,2,FAUX)
I guess in UK would be
=VLOOKUP(G5,Sheet1!E3:G5,2,FALSE)
so you are only looking in rows 3,4 & 5
looking in column E range row 3 to 5 for a match with G5
if a match found then return the 2nd column starting from E
so thats column F
 
Upvote 0
Unless I am missing something here, you are trying to retrieve a value (from col F) to the left of the value you are looking up (col G). VLookup can't do that without introducing a work around, so it is simpler just to use Index Match.

eg
Book2
EFG
3UNITSCUSTOMERCODE
4#N/A1003
5Nick1001
Sheet2
Cell Formulas
RangeFormula
F4:F5F4=INDEX(Sheet1!$F$4:$F$5,MATCH(G4,Sheet1!$G$4:$G$5,0),1)
 
Upvote 0

Forum statistics

Threads
1,226,411
Messages
6,190,897
Members
453,624
Latest member
Mlove46

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top