Multiple, nested, if, and, or, merge help please.

aiki100

Board Regular
Joined
Aug 16, 2016
Messages
102
Hello all -


I would be very grateful for any help with the following:


A very helpful board member, jtakw, helped put together the following:


=IF(OR(BB2="",AND($AR2="x",OR($AZ2={"L","S"}),$AV2="O",OR(H3<$J2,H3>$I2))),"",IF($AR2="x",IF(AND($AZ2="L",J3>$BF2),IF(OR($AV2={"C","O"}),K3-$BB2,IF($AV2="B",K3-$BB2,IF(AND($AZ2="S",OR($AV2={"C","O","B"}),I3<$BF2),$BB2-K3,IF(AND($AZ2="L",J3<=$BF2),$BF2-$BB2,IF(AND($AZ2="S",I3>=$BF2),$BB2-$BF2,""))))))))


This formula worked, but was producing FALSE errors. I traced this to my sample data having cells that did indeed breech certain limits that were not accounted for in this (very good and useful) formula above. My fault in not seeing the pitfall beforehand. So what I did, was create the following to handle these exceptions:


=IF(BB2="","",IF(AND($AR2="x",$AZ2="L",$AV2="C",H3<$J2),H3-$BB2,IF(AND($AR2="x",$AZ2="L",$AV2="O",H3<$J2),H3-$BB2,IF(AND($AR2="x",$AZ2="S",$AV2="C",H3>$I2),$BB2-H3,IF(AND($AR2="x",$AZ2="S",$AV2="O",H3>$I2),$BB2-H3,"")))))


I believe this now handles the exceptions in the sample data, but is, of course, missing inclusion in Jtakw's overall formula.

Might someone have thoughts on how to merge the two?



Thanks so much for the help, and again to jtakw, for setting me on the right path.
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

Forum statistics

Threads
1,223,888
Messages
6,175,203
Members
452,617
Latest member
Narendra Babu D

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