VLOOKUP IF AND Nested Statement Help

TheCobbler

New Member
Joined
Aug 21, 2021
Messages
49
Office Version
  1. 365
Platform
  1. Windows
Hi, I'm trying to nest all of these statements together without much luck. Could somebody help? Thanks in advance. Cobb


=

IF(AND(J2="PHD",F2="CDs FP10/09"),(VLOOKUP(H2,'CD BIN'!$A$2:$B$52,2,TRUE))+0.25),

IF(AND(J2="PHD",F2="NEW09 Vinyl"),(VLOOKUP(H2,'LP BIN'!$A$2:$B$88,2,TRUE))+0.50),

IF(AND(J2="PRP",F2="DVDs FP10/09"),(VLOOKUP(H2,'CD BIN'!$A$2:$B$52,2,TRUE)+0.25)),

IF(AND J2="PRP",F2="Plastic Head Hoodies"),(VLOOKUP(H2,'CD BIN'!$A$2:$B$52,2,TRUE))+1.25),

IF(AND(J2="PRP",F2="Plastic Head T-Shirts"),(VLOOKUP(H2,'CD BIN'!$A$2:$B$52,2,TRUE))+1.25),

IF(F2="CD",(VLOOKUP(H2,'CD BIN'!$A$2:$B$52,2,TRUE),

IF(F2="LP",(VLOOKUP(H2,'LP BIN'!$A$2:$B$88,2,TRUE),

"MANUAL")
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Maybe
Excel Formula:
=IF(AND(J2="PHD",F2="CDs FP10/09"),VLOOKUP(H2,'CD BIN'!$A$2:$B$52,2,TRUE)+0.25,
IF(AND(J2="PHD",F2="NEW09 Vinyl"),VLOOKUP(H2,'LP BIN'!$A$2:$B$88,2,TRUE)+0.5,
IF(AND(J2="PRP",F2="DVDs FP10/09"),VLOOKUP(H2,'CD BIN'!$A$2:$B$52,2,TRUE)+0.25,
IF(AND(J2="PRP",F2="Plastic Head Hoodies"),VLOOKUP(H2,'CD BIN'!$A$2:$B$52,2,TRUE)+1.25,
IF(AND(J2="PRP",F2="Plastic Head T-Shirts"),VLOOKUP(H2,'CD BIN'!$A$2:$B$52,2,TRUE)+1.25,
IF(F2="CD",VLOOKUP(H2,'CD BIN'!$A$2:$B$52,2,TRUE),
IF(F2="LP",VLOOKUP(H2,'LP BIN'!$A$2:$B$88,2,TRUE),
"MANUAL")))))))
 
Upvote 0
Solution
Note that it also looks like you could reduce the levels of nesting down a bit by incorporating some OR statements since there are multiple scenarios that have the same end results.

For example, these two:
Rich (BB code):
IF(AND(J2="PHD",F2="CDs FP10/09"),VLOOKUP(H2,'CD BIN'!$A$2:$B$52,2,TRUE)+0.25
and
Rich (BB code):
IF(AND(J2="PRP",F2="DVDs FP10/09"),VLOOKUP(H2,'CD BIN'!$A$2:$B$52,2,TRUE)+0.25
both perform this step when TRUE:
Rich (BB code):
VLOOKUP(H2,'CD BIN'!$A$2:$B$52,2,TRUE)+0.25

So, you could combine the two to this:
Rich (BB code):
IF(OR(AND(J2="PHD",F2="CDs FP10/09"),AND(J2="PRP",F2="DVDs FP10/09")),VLOOKUP(H2,'CD BIN'!$A$2:$B$52,2,TRUE)+0.25

And you have another one that can be combined in this matter to (the two that both have:
Excel Formula:
VLOOKUP(H2,'CD BIN'!$A$2:$B$52,2,TRUE)+1.25
in the TRUE clause).
 
Upvote 0
Note that it also looks like you could reduce the levels of nesting down a bit by incorporating some OR statements since there are multiple scenarios that have the same end results.

For example, these two:
Rich (BB code):
IF(AND(J2="PHD",F2="CDs FP10/09"),VLOOKUP(H2,'CD BIN'!$A$2:$B$52,2,TRUE)+0.25
and
Rich (BB code):
IF(AND(J2="PRP",F2="DVDs FP10/09"),VLOOKUP(H2,'CD BIN'!$A$2:$B$52,2,TRUE)+0.25
both perform this step when TRUE:
Rich (BB code):
VLOOKUP(H2,'CD BIN'!$A$2:$B$52,2,TRUE)+0.25

So, you could combine the two to this:
Rich (BB code):
IF(OR(AND(J2="PHD",F2="CDs FP10/09"),AND(J2="PRP",F2="DVDs FP10/09")),VLOOKUP(H2,'CD BIN'!$A$2:$B$52,2,TRUE)+0.25

And you have another one that can be combined in this matter to (the two that both have:
Excel Formula:
VLOOKUP(H2,'CD BIN'!$A$2:$B$52,2,TRUE)+1.25
in the TRUE clause).

Thanks Joe. I'll definitely investigate this. Makes complete sense once I see it typed up!
 
Upvote 0
Maybe
Excel Formula:
=IF(AND(J2="PHD",F2="CDs FP10/09"),VLOOKUP(H2,'CD BIN'!$A$2:$B$52,2,TRUE)+0.25,
IF(AND(J2="PHD",F2="NEW09 Vinyl"),VLOOKUP(H2,'LP BIN'!$A$2:$B$88,2,TRUE)+0.5,
IF(AND(J2="PRP",F2="DVDs FP10/09"),VLOOKUP(H2,'CD BIN'!$A$2:$B$52,2,TRUE)+0.25,
IF(AND(J2="PRP",F2="Plastic Head Hoodies"),VLOOKUP(H2,'CD BIN'!$A$2:$B$52,2,TRUE)+1.25,
IF(AND(J2="PRP",F2="Plastic Head T-Shirts"),VLOOKUP(H2,'CD BIN'!$A$2:$B$52,2,TRUE)+1.25,
IF(F2="CD",VLOOKUP(H2,'CD BIN'!$A$2:$B$52,2,TRUE),
IF(F2="LP",VLOOKUP(H2,'LP BIN'!$A$2:$B$88,2,TRUE),
"MANUAL")))))))

Perfect - Thanks for your assistance! I'll compare this to my original code and figure out the differences.
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,216,272
Messages
6,129,822
Members
449,538
Latest member
cookie2956

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