nested if statement problem

monsierexcel

New Member
Joined
Nov 19, 2018
Messages
29
Hello all, i cant find why this doesnt work

=IF(VLOOKUP(C2,'cost prices'!$B:$J,9,0),VLOOKUP(C2,'cost prices'!$B:$J,9,0),IF(VLOOKUP(C2,'cost prices'!$B:$I,8,0),VLOOKUP(C2,'cost prices'!$B:$I,8,0),IF(VLOOKUP(C2,'cost prices'!$B:$H,7,0),VLOOKUP(C2,'cost prices'!$B:$H,7,0),IF(VLOOKUP(C2,'Kit Products Cost Prices'!$B:$J,9,0),VLOOKUP(C2,'Kit Products Cost Prices'!$B:$J,9,0),IF(VLOOKUP(C2,'Kit Products Cost Prices'!$B:$I,8,0),VLOOKUP(C2,'Kit Products Cost Prices'!$B:$I,8,0),IF(VLOOKUP(C2,'Kit Products Cost Prices'!$B:$H,7,0),VLOOKUP(C2,'Kit Products Cost Prices'!$B:$H,7,0),VLOOKUP(C2,'Kit Pricing not in AP'!$A:$B,2,0)))))))

when i look at function arguments for the line:

IF(VLOOKUP(C2,'Kit Products Cost Prices'!$B:$H,7,0),VLOOKUP(C2,'Kit Products Cost Prices'!$B:$H,7,0),VLOOKUP(C2,'Kit Pricing not in AP'!$A:$B,2,0)

which shows its finding the correct value yet it still showing an NA error on return :( i cant figure this when the condition is showing the right value at 154.08!

I know you can have upto 7 nested IF statements but i only have 6 here.

thank you,
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
That will produce NA error if whatever is in C2 is not found in column B of cost prices, if it is found in cost prices and they are all blank or 0 then it will NA error if not found in Kit Products Cost Prices etc.
 
Upvote 0
Is this what you are wanting to achieve

=IFERROR(VLOOKUP(C2,'Kit Products Cost Prices'!$B:$H,7,0),IFERROR(VLOOKUP(C2,'Kit Pricing not in AP'!$A:$B,2,0),"NOT FOUND"))
 
Upvote 0
Where is the boolian argument in the if statement? VLOOKUP will return what it finds: 154.08 which is not true/false.
 
Upvote 0
if i produce this section of the formula as a seperate formula....

=IF(VLOOKUP(C2,'Kit Products Cost Prices'!$B:$H,7,0),VLOOKUP(C2,'Kit Products Cost Prices'!$B:$H,7,0),VLOOKUP(C2,'Kit Pricing not in AP'!$A:$B,2,0))

it produces the correct value of 154.08
so i am unsure why its showing N/a as all vlookup statements are correct??

When i nest this statement in here:
=IF(VLOOKUP(C2,'cost prices'!$B:$J,9,0),VLOOKUP(C2,'cost prices'!$B:$J,9,0),IF(VLOOKUP(C2,'cost prices'!$B:$I,8,0),VLOOKUP(C2,'cost prices'!$B:$I,8,0),IF(VLOOKUP(C2,'cost prices'!$B:$H,7,0),VLOOKUP(C2,'cost prices'!$B:$H,7,0),IF(VLOOKUP(C2,'Kit Products Cost Prices'!$B:$J,9,0),VLOOKUP(C2,'Kit Products Cost Prices'!$B:$J,9,0),IF(VLOOKUP(C2,'Kit Products Cost Prices'!$B:$I,8,0),VLOOKUP(C2,'Kit Products Cost Prices'!$B:$I,8,0),IF(VLOOKUP(C2,'Kit Products Cost Prices'!$B:$H,7,0),VLOOKUP(C2,'Kit Products Cost Prices'!$B:$H,7,0),VLOOKUP(C2,'Kit Pricing not in AP'!$A:$B,2,0)))))))

it fails?
 
Upvote 0
Then its failing before that statement is reached. It may be better to say what you are attempting to do.
 
Upvote 0
i am trying to retrieve information from 3 possible columns first in column J, then if no value look in column I, then if no value look in column H in "cost prices", however if the value is not found i in those 3 columns, then must look in column J of "Kit products Cost price", if its not found in there it then needs to look in column B of "kit pricing not in AP"
 
Upvote 0
Have a look at post#3
The method should work for you

Start with
=IFERROR(VLOOKUP(C2,'Kit Pricing not in AP'!$A:$B,2,0),"NOT FOUND")
then
IFERROR(VLOOKUP(...),IFERROR(VLOOKUP(C2,'Kit Pricing not in AP'!$A:$B,2,0),"NOT FOUND"))
then
IFERROR(VLOOKUP(...),IFERROR(VLOOKUP(...),IFERROR(VLOOKUP(C2,'Kit Pricing not in AP'!$A:$B,2,0),"NOT FOUND")))
etc
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,952
Messages
6,175,593
Members
452,654
Latest member
mememe101

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