Help with Vlookups

agerrard

Active Member
Joined
Apr 4, 2005
Messages
407
Hi all,

Im using Excel 2003.

My probem is to do with the formulas in the columns H, I, J & K. So my formula is (in cell H2787):

=IF(('Actual Scan Data'!DK4)*1000=0,'Model Summary Sheet'!H861,('Actual Scan Data'!DK4)*1000

This was fine before i realised that i needed to put a vlookup in the formula as i need to vlookup using the "EAN" code in column A. I dont need to vlookup for the values in the Model Summary Sheet, its just for the data in the Actual Scan Data.

Also if there happens to be any blank cells in the Actual Scan Data sheet wont that return errors? so is there a way to take those into account as well?

Hope this is enough information. Thanks in advance!
Sample Sheet_1.xls
ABCDEFGHIJK
2786EANRetailer'sGMSizeBrandItemItemCodeAssortmentWk_1Wk_2Wk_3Wk_4
27879310052551216Actual&PredictedRSV$250gBrand_1Product_111158000Product_1$32,840.1$30,482.8$19,973.0$12,042.3
27889310052315207Actual&PredictedRSV$1kgBrand_1Product_211497000Product_2$5,434.3$5,434.3$5,434.3$5,434.3
27899310052351205Actual&PredictedRSV$250gBrand_1Product_311150000Product_3$-$-$-$-
27909310052333201Actual&PredictedRSV$500gBrand_1Product_411151000Product_4$-$-$-$-
27919310052433239Actual&PredictedRSV$250gBrand_1Product_511166000Product_5$83,964.1$89,661.5$67,216.7$72,976.3
27929310052111434Actual&PredictedRSV$250gBrand_2Product_611167000Product_6$106,443.9$61,678.9$59,467.9$60,411.9
27939310052111441Actual&PredictedRSV$500gBrand_2Product_711170001Product_7$74,429.6$74,149.0$74,823.4$70,370.2
27949310052415204Actual&PredictedRSV$1kgBrand_2Product_811165000Product_8$83,613.0$83,613.0$6.5$83,613.0
27959310052451202Actual&PredictedRSV$250gBrand_3Product_911159000Product_9$69,923.2$69,923.2$69,923.2$69,923.2
27969310052551209Actual&PredictedRSV$250gBrand_3Product_1011155000Product_10$44,347.2$23,122.4$24,471.2$24,061.2
Model Summary Sheet
 
Ok just had a play and this is the formula that i hoped would work, but no luck :(

If you look at cell H2786 and the formula reads:

=IF(VLOOKUP(A2787,'Actual Scan Data'!$DJ:$FJ,2,FALSE)*1000=0,'Model Summary Sheet'!H861,VLOOKUP(A2787,'Actual Scan Data'!$DJ:$FJ,2,FALSE)*1000)

So i hoped the vlookup would go away and find the data for that week based on the EAN code (taken from the Actual Scan Data sheet). If data was there then that gets put into the cell. But if no data is in that range, then my forecast data (from the "model summary sheet") would be put in its place.

This was happening before, but my data from the "Actual Scan Data" sheet was not corresponding to the correct item as i wasnt using vlookups.

Hope this makes sense. Any help appreciated :)
Sample Sheet_1.xls
ABCDEFGH
2786EANRetailer'sGMSizeBrandItemItemCodeAssortmentWk_1
27879310052551216Actual&PredictedRSV$250gBrand_1Product_111158000Product_1#N/A
27889310052315207Actual&PredictedRSV$1kgBrand_1Product_211497000Product_2$5,434.3
Model Summary Sheet
 
Upvote 0
ok, so working through my formula before i found that it was ok. It was just the fact that the EAN reference numbers in the "actual scan data" sheet weren't formatted as numbers so thats why it wasn't working. phew!

but next problem is that i get #N/A errors in some of my cells. so how do i write them out whilst keeping my formula? (in the last post)

cheers!
 
Upvote 0
So here's what i thought would work:

=IF(ISERROR(IF(VLOOKUP($A2804,'Actual Scan Data'!$FL:$HM,'Actual Scan Data'!FN$2,FALSE)=0,0,'Model Summary Sheet'!H878,VLOOKUP($A2804,'Actual Scan Data'!$FL:$HM,'Actual Scan Data'!FN$2,FALSE))

so i inserted in ISERROR into my formula, but that still doesn't work, so not really sure what im doing wrong.
 
Upvote 0
This will enter a Blank instead of #N/A

=IF(ISERROR(IF(VLOOKUP(A2787,'Actual Scan Data'!$DJ:$FJ,2,FALSE)*1000=0,'Model Summary Sheet'!H861,VLOOKUP(A2787,'Actual Scan Data'!$DJ:$FJ,2,FALSE)*1000)),"",IF(VLOOKUP(A2787,'Actual Scan Data'!$DJ:$FJ,2,FALSE)*1000=0,'Model Summary Sheet'!H861,VLOOKUP(A2787,'Actual Scan Data'!$DJ:$FJ,2,FALSE)*1000))
 
Upvote 0
hi markoakes,

thanks for getting back to me. that formula works great for the cells where i was getting the errors. but when i copied to the other cells where i know there is data, i get a "false" value that comes up in each of those cells?

so not sure why that is. is there a way to get around this do you think?
 
Upvote 0
If you are getting a "False" then the Look Up formula is not finding what it is looking for on the 'Actual Scan Data'. If you use the formula that you posted in your second formula you should also get "False". You need to review the 'Actual Scan Data' and see why the Look Up can't find the data it is serching for.
 
Upvote 0
OK so here is where im currently at.

My new formula is working perfectly for the cells where i know there is data in both the ranges (so either in the actual scan summary sheet or the model summary sheet)

This is the formula that is working (from cell H2787)

=IF(VLOOKUP($A2787,'Actual Scan Data'!$FL:$HM,'Actual Scan Data'!FN$2,FALSE)=0,'Model Summary Sheet'!H861,VLOOKUP($A2787,'Actual Scan Data'!$FL:$HM,'Actual Scan Data'!FN$2,FALSE))
Sample Sheet_1.xls
ABCDEFGH
2786EANRetailer'sGMSizeBrandItemItemCodeAssortmentWk_1
27879310052551216Actual&PredictedRSV$250gBrand_1Product_111158000Product_1$26,988.3
27889310052315207Actual&PredictedRSV$1kgBrand_1Product_211497000Product_2$32,840.1
27899310052351205Actual&PredictedRSV$250gBrand_1Product_311150000Product_3$-
27909310052333201Actual&PredictedRSV$500gBrand_1Product_411151000Product_4$-
27919310052433239Actual&PredictedRSV$250gBrand_1Product_511166000Product_5$20,424.4
27929310052111434Actual&PredictedRSV$250gBrand_2Product_611167000Product_6$34,162.6
27939310052111441Actual&PredictedRSV$500gBrand_2Product_711170001Product_7$27,989.5
27949310052415204Actual&PredictedRSV$1kgBrand_2Product_811165000Product_8$83,964.1
27959310052451202Actual&PredictedRSV$250gBrand_3Product_911159000Product_9$106,443.9
27969310052551209Actual&PredictedRSV$250gBrand_3Product_1011155000Product_10$44,347.2
27979310052533205Actual&PredictedRSV$500gBrand_3Product_1111156000Product_11$23,272.0
27989310052433253Actual&PredictedRSV$500gBrand_3Product_1211176000Product_12$35,716.9
27999310264911099Actual&PredictedRSV$500gBrand_4Product_1311175001Product_13$34,568.9
28009310052433208Actual&PredictedRSV$500gBrand_5Product_1411169001Product_14$74,429.6
28019414832141502Actual&PredictedRSV$125gBrand_6Product_1527244001Product_15$-
28029414832191026Actual&PredictedRSV$125gBrand_7Product_1627285001Product_16$-
28039414832260036Actual&PredictedRSV$500gBrand_8Product_1727908001Product_17$-
28049414832111802Actual&PredictedRSV$250gBrand_9Product_1827250001Product_18#N/A
Model Summary Sheet


However this doesnt work when there are #N/A errors (see cell H2804). So in my next sample i've copied the formula that markoakes gave me to show you what happened.

So its removed the #N/A error which is great, but when i copied that formula to the other cells its returned a FALSE value. And i know for sure that there are data for those items, so not sure how to fix this.
Sample Sheet_1.xls
ABCDEFGH
2786EANRetailer'sGMSizeBrandItemItemCodeAssortmentWk_1
27879310052551216Actual&PredictedRSV$250gBrand_1Product_111158000Product_1FALSE
27889310052315207Actual&PredictedRSV$1kgBrand_1Product_211497000Product_2FALSE
27899310052351205Actual&PredictedRSV$250gBrand_1Product_311150000Product_3$-
27909310052333201Actual&PredictedRSV$500gBrand_1Product_411151000Product_4$-
27919310052433239Actual&PredictedRSV$250gBrand_1Product_511166000Product_5FALSE
27929310052111434Actual&PredictedRSV$250gBrand_2Product_611167000Product_6FALSE
27939310052111441Actual&PredictedRSV$500gBrand_2Product_711170001Product_7FALSE
27949310052415204Actual&PredictedRSV$1kgBrand_2Product_811165000Product_8FALSE
27959310052451202Actual&PredictedRSV$250gBrand_3Product_911159000Product_9FALSE
27969310052551209Actual&PredictedRSV$250gBrand_3Product_1011155000Product_10FALSE
27979310052533205Actual&PredictedRSV$500gBrand_3Product_1111156000Product_11FALSE
27989310052433253Actual&PredictedRSV$500gBrand_3Product_1211176000Product_12FALSE
27999310264911099Actual&PredictedRSV$500gBrand_4Product_1311175001Product_13FALSE
28009310052433208Actual&PredictedRSV$500gBrand_5Product_1411169001Product_14FALSE
28019414832141502Actual&PredictedRSV$125gBrand_6Product_1527244001Product_15$-
28029414832191026Actual&PredictedRSV$125gBrand_7Product_1627285001Product_16$-
28039414832260036Actual&PredictedRSV$500gBrand_8Product_1727908001Product_17$-
28049414832111802Actual&PredictedRSV$250gBrand_9Product_1827250001Product_18-
Model Summary Sheet
 
Upvote 0
hi markoakes,

just read your second post. its bizarre that i get values from the actual scan data sheet using the formula before i modified it. so i know that that vlook up was fine. its just getting rid of those darn errors. when i used your one it was great for the cells that had errors but it gave me those false returns for the cells that did have data.

so is it the order of the formula? or is there something else? im completely stumped :(
 
Upvote 0

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