Nested If Statements

Tennisguuy

Well-known Member
Joined
Oct 17, 2007
Messages
564
Office Version
  1. 2016
Platform
  1. Windows
I am having a problem with a nested if statement. I have a situation where if the first three digits in cell E38 of a value equal a certain number and or if the value in cell F38 or G38 are less than a value I wanted a statement to appear. This is the formula I used in cell H38

IF(E38="","",IF(AND(F38="",G38=""),"",IF(OR(LEFT(E38,3)=211,LEFT(E38,3)=212,LEFT(E38,3)=213,LEFT(E38,3)=214,LEFT(E38,3)=215,LEFT(E38,3)=216,LEFT(E38,3)=231,LEFT(E38,3)=232,LEFT(E38,3)=233,LEFT(E38,3)=234,LEFT(E38,3)=235,LEFT(E38,3)=236,AND(OR(F38<1000,G38<1000))),"MINIMUM DED IS 1,000/1,000",IF(OR(LEFT(E38,3)=311,LEFT(E38,3)=312,LEFT(E38,3)=313,LEFT(E38,3)=314,LEFT(E38,3)=315,LEFT(E38,3)=316,LEFT(E38,3)=331,LEFT(E38,3)=332,LEFT(E38,3)=333,LEFT(E38,3)=334,LEFT(E38,3)=335,LEFT(E38,3)=336,AND(OR(F38<2000,G38<2000))),"MINIMUM DED IS 2,000/2,000",IF(OR(LEFT(E38,3)=401,LEFT(E38,3)=402,LEFT(E38,3)=403,LEFT(E38,3)=404,LEFT(E38,3)=405,LEFT(E38,3)=406,AND(OR(F38<3000,G38<3000))),"MINIMUM DED IS 3,000/3,000",IF(OR(LEFT(E38,3)=501,LEFT(E38,3)=502,LEFT(E38,3)=503,LEFT(E38,3)=504,LEFT(E38,3)=505,LEFT(E38,3)=506,AND(OR(F38<3000,G38<3000))),"MINIMUM DED IS 3,000/3,000",IF(AND(F38<500,G38<500),"MINIMUM DED IS 500/500","")))))))

For example if the value in cell E38 is 21499 and the value in cell F38 is 500 and the value in cell G38 is 1,000 I wanted the statement minimum ded is 1000/1000 since one of the values in cell F38 or G38 is less than 1000. When I enter those value I get the correct statement. However, if I just changed the value in cell E38 to 31499 and don't change the values in cell F38 or G38 the same statement minimum deductible is 1000/1000 and the statement that should appear is minimum deductible is 2000/2000. However if I change the value in cell F38 from 500 to 1000 the correct statement appears. If I change the value in cell E38 to 7389 and change the value in cell F38 to 250 and value in cell G38 to 500. The statement minimum ded is 1,000/1,000 appears and the correct statement should be minimum deductible is 500/500.

I tried different variations to get the formula to work and in some situation it would but in others it wouldn't.

Is my setup incorrect.
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.

Forum statistics

Threads
1,215,008
Messages
6,122,672
Members
449,091
Latest member
peppernaut

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