VLookup Struggles

jarett

Board Regular
Joined
Apr 12, 2021
Messages
165
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I do not use the VLOOKUP a lot and always struggle when I do. I know the most common reason for errors is the lookup value data not being in the most left column. I have tried putting the lookup columns on the same sheet and same result. What am I missing?
Book1.xlsx
ABCDEFGHIJKLM
1Item CodeProductLineDescriptionPrimaryVendorNoWarehouseCodeUDF_INVENTORIED_ITEMTotalQuantityOnHandLastPhysicalCountDateUDF_UNIQUEKEYUDF_UPCStandardUnitCostLastSoldDate
2054X-BLACKAHanes EcoSmart - 5.2-Ounce Jer0001904000N0.000.00#N/A
3054X-BLACK-2XLAHanes EcoSmart - 5.2-Ounce Jer0001904000N0.00630117663690666128.53#N/A
4054X-BLACK-3XLAHanes EcoSmart - 5.2-Ounce Jer0001904000N0.00837027663690666299.315/25/2023#N/A
5054X-BLACK-LAHanes EcoSmart - 5.2-Ounce Jer0001904000N0.00630047663690665996.658/8/2023#N/A
6054X-BLACK-MAHanes EcoSmart - 5.2-Ounce Jer0001904000N0.00630037663690665826.6512/8/2023#N/A
7054X-BLACK-SAHanes EcoSmart - 5.2-Ounce Jer0001904000N0.00630027663690665756.65#N/A
8054X-BLACK-XLAHanes EcoSmart - 5.2-Ounce Jer0001904000N0.00630057663690666056.65#N/A
9054X-DEEP FORESTAHanes EcoSmart - 5.2-Ounce Jer0001904000N0.000.00#N/A
10054X-DEEP FOREST-2XLAHanes EcoSmart - 5.2-Ounce Jer0001904000N0.003109617663691217178.53#N/A
11054X-DEEP FOREST-3XLAHanes EcoSmart - 5.2-Ounce Jer0001904000N0.003109727663691217249.315/25/2023#N/A
12054X-DEEP FOREST-LAHanes EcoSmart - 5.2-Ounce Jer0001904000N0.003109547663691216946.65#N/A
13054X-DEEP FOREST-MAHanes EcoSmart - 5.2-Ounce Jer0001904000N0.003109537663691216876.65#N/A
14054X-DEEP FOREST-SAHanes EcoSmart - 5.2-Ounce Jer0001904000N0.003109527663691216706.65#N/A
15054X-DEEP FOREST-XLAHanes EcoSmart - 5.2-Ounce Jer0001904000N0.003109557663691217006.65#N/A
Sheet1
Cell Formulas
RangeFormula
M2:M15M2=VLOOKUP(I2,Sheet2!A1:B25,2,FALSE)
Named Ranges
NameRefers ToCells
Sheet2!_FilterDatabase=Sheet2!$A$1:$B$1M2

Book1.xlsx
AB
1 unique_key my_price
2628725.06
3628735.06
4628745.06
5628755.06
6628815.66
7629126.84
8629136.84
9629146.84
10629156.84
11629218.78
12629329.59
13630026.84
14630036.84
15630046.84
16630056.84
17630118.78
18647022.37
19647032.37
20647042.37
21647052.37
22656112.35
23656122.35
24656132.35
25656142.35
26656152.35
27656212.65
28656222.65
29656232.65
30656242.65
31656252.65
32656312.65
33656322.65
34656332.65
35656342.65
36656352.65
37656412.65
Sheet2
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
works OK
if i change a value in sheet 2 to match column 1
like

i put 1 on sheet2 A2
and 1 on sheet1 I2

and returns the value in B

but the numbers in I have to match with a value in A

Book2
AB
1 unique_key my_price
215.06
3628735.06
4628745.06
5628755.06
6628815.66
7629126.84
8629136.84
9629146.84
Sheet2


Book2
ABCDEFGHIJKLM
1Item CodeProductLineDescriptionPrimaryVendorNoWarehouseCodeUDF_INVENTORIED_ITEMTotalQuantityOnHandLastPhysicalCountDateUDF_UNIQUEKEYUDF_UPCStandardUnitCostLastSoldDate
2054X-BLACKAHanes EcoSmart - 5.2-Ounce Jer19040N0105.06
3054X-BLACK-2XLAHanes EcoSmart - 5.2-Ounce Jer19040N0630117.66369E+118.53#N/A
Sheet1
Cell Formulas
RangeFormula
M2:M3M2=VLOOKUP(I2,Sheet2!A1:B25,2,FALSE)
 
Upvote 0
works OK
if i change a value in sheet 2 to match column 1
like

i put 1 on sheet2 A2
and 1 on sheet1 I2

and returns the value in B

but the numbers in I have to match with a value in A

Book2
AB
1 unique_key my_price
215.06
3628735.06
4628745.06
5628755.06
6628815.66
7629126.84
8629136.84
9629146.84
Sheet2


Book2
ABCDEFGHIJKLM
1Item CodeProductLineDescriptionPrimaryVendorNoWarehouseCodeUDF_INVENTORIED_ITEMTotalQuantityOnHandLastPhysicalCountDateUDF_UNIQUEKEYUDF_UPCStandardUnitCostLastSoldDate
2054X-BLACKAHanes EcoSmart - 5.2-Ounce Jer19040N0105.06
3054X-BLACK-2XLAHanes EcoSmart - 5.2-Ounce Jer19040N0630117.66369E+118.53#N/A
Sheet1
Cell Formulas
RangeFormula
M2:M3M2=VLOOKUP(I2,Sheet2!A1:B25,2,FALSE)
Does the format of the cells have to match? I tried the same thing on my copies and it didn't work?
 
Upvote 0
yes, they do need to be numbers and not text - usually that would mean the numbers are left justified

seems to work - i copied the formula again down the sheet

added to a drop box share - will be available for a few days

Book2
ABCDEFGHIJKLM
1Item CodeProductLineDescriptionPrimaryVendorNoWarehouseCodeUDF_INVENTORIED_ITEMTotalQuantityOnHandLastPhysicalCountDateUDF_UNIQUEKEYUDF_UPCStandardUnitCostLastSoldDate
2054X-BLACKAHanes EcoSmart - 5.2-Ounce Jer19040N0105.06
3054X-BLACK-2XLAHanes EcoSmart - 5.2-Ounce Jer19040N0630117.66369E+118.538.78
4054X-BLACK-3XLAHanes EcoSmart - 5.2-Ounce Jer19040N0837027.66369E+119.315/25/2023#N/A
5054X-BLACK-LAHanes EcoSmart - 5.2-Ounce Jer19040N0630047.66369E+116.658/8/236.84
6054X-BLACK-MAHanes EcoSmart - 5.2-Ounce Jer19040N0630037.66369E+116.658/12/236.84
7054X-BLACK-SAHanes EcoSmart - 5.2-Ounce Jer19040N0630027.66369E+116.656.84
8054X-BLACK-XLAHanes EcoSmart - 5.2-Ounce Jer19040N0630057.66369E+116.656.84
9054X-DEEP FORESTAHanes EcoSmart - 5.2-Ounce Jer19040N00#N/A
10054X-DEEP FOREST-2XLAHanes EcoSmart - 5.2-Ounce Jer19040N03109617.66369E+118.53#N/A
11054X-DEEP FOREST-3XLAHanes EcoSmart - 5.2-Ounce Jer19040N03109727.66369E+119.315/25/2023#N/A
12054X-DEEP FOREST-LAHanes EcoSmart - 5.2-Ounce Jer19040N03109547.66369E+116.65#N/A
Sheet1
Cell Formulas
RangeFormula
M2:M12M2=VLOOKUP(I2,Sheet2!A1:B25,2,FALSE)
 
Upvote 0
Your list (Sheet2!A1:B37) is longer than your formula accommodates (Sheet2!A1:B25), so that could be the source of some errors . I had no problems, just #N/A errors where sheet1 column i was blank or did not match anything in the list (red).

Book1
ABCDEFGHIJKLM
1Item CodeProductLineDescriptionPrimaryVendorNoWarehouseCodeUDF_INVENTORIED_ITEMTotalQuantityOnHandLastPhysicalCountDateUDF_UNIQUEKEYUDF_UPCStandardUnitCostLastSoldDate
2054X-BLACKAHanes EcoSmart - 5.2-Ounce Jer19040N00#N/A
3054X-BLACK-2XLAHanes EcoSmart - 5.2-Ounce Jer19040N0630117.66E+118.538.78
4054X-BLACK-3XLAHanes EcoSmart - 5.2-Ounce Jer19040N0837027.66E+119.315/25/2023#N/A
5054X-BLACK-LAHanes EcoSmart - 5.2-Ounce Jer19040N0630047.66E+116.6508-08-236.84
6054X-BLACK-MAHanes EcoSmart - 5.2-Ounce Jer19040N0630037.66E+116.6512-08-236.84
7054X-BLACK-SAHanes EcoSmart - 5.2-Ounce Jer19040N0630027.66E+116.656.84
8054X-BLACK-XLAHanes EcoSmart - 5.2-Ounce Jer19040N0630057.66E+116.656.84
9054X-DEEP FORESTAHanes EcoSmart - 5.2-Ounce Jer19040N00#N/A
10054X-DEEP FOREST-2XLAHanes EcoSmart - 5.2-Ounce Jer19040N03109617.66E+118.53#N/A
11054X-DEEP FOREST-3XLAHanes EcoSmart - 5.2-Ounce Jer19040N03109727.66E+119.315/25/2023#N/A
12054X-DEEP FOREST-LAHanes EcoSmart - 5.2-Ounce Jer19040N03109547.66E+116.65#N/A
13054X-DEEP FOREST-MAHanes EcoSmart - 5.2-Ounce Jer19040N03109537.66E+116.65#N/A
14054X-DEEP FOREST-SAHanes EcoSmart - 5.2-Ounce Jer19040N03109527.66E+116.65#N/A
15054X-DEEP FOREST-XLAHanes EcoSmart - 5.2-Ounce Jer19040N03109557.66E+116.65#N/A
Sheet1
Cell Formulas
RangeFormula
M2:M15M2=VLOOKUP(I2,Sheet2!A1:B37,2,FALSE)
 
Upvote 0
On the Formulas ribbon tab, check in the Calculation Options drop-down that your calculation is set to Automatic.

1704853928864.png


Also, your formula in M2 and copied down should have some $ signs
=VLOOKUP(I2,Sheet2!A$1:B$25,2,FALSE)
 
Upvote 0
Solution
Made sure both columns were numbers format @etaf and used the formula @Peter_SSs recommended and got a good result, thanks!
 
Upvote 0
Glad we were able to help. Thanks for the follow-up. :)
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,959
Members
449,096
Latest member
Anshu121

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