Nested IF AND

Alex501

Board Regular
Joined
Dec 11, 2015
Messages
59
Office Version
  1. 365
  2. 2019
Hi

I need a bit of help with a nested IF AND formula. I can get nested IF's to work with no problem, however if I add and into the mix it seems to go awry. The data i have is as follows;


[TABLE="width: 218"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]2500[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]2500[/TD]
[TD]No[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]1200[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]1200[/TD]
[TD]No[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]1900[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]1900[/TD]
[TD]No[/TD]
[/TR]
</tbody>[/TABLE]

The equation is as follows;

IF(AND(A2>2190,B2="No","Yes",IF(AND(A2>1825,B2="Yes","Yes","No"))))

What I'm expecting is that row 1 and 2 would be 'Yes', rows 3 and 4 would be 'No', row 5 'Yes' and row 6 'No' - however I keep getting errors in the equation and can't seem to see where it's going wrong.

Thanks for any help.

Alex
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
dont use IIF, use a table, youve done half the work!

Put these values into a table and let the FUNCTiON pull the data.
the function will look it up. VLOOKUP.
 
Last edited:
Upvote 0
You have your brackets in the wrong place. You need to close your AND statements after the second condition so that the "Yes" output is in the TRUE part of the IF statement, and so on:
=IF(AND(A2>2190,B2="No"),"Yes",IF(AND(A2>1825,B2="Yes"),"Yes","No"))
 
Upvote 0
You have your brackets in the wrong place. You need to close your AND statements after the second condition so that the "Yes" output is in the TRUE part of the IF statement, and so on:
=IF(AND(A2>2190,B2="No"),"Yes",IF(AND(A2>1825,B2="Yes"),"Yes","No"))

Hi Selig

Perfect, that did the trick. Thanks for your help.
 
Upvote 0

Forum statistics

Threads
1,224,750
Messages
6,180,740
Members
452,996
Latest member
nelsonsix66

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