Listing multiple criteria in IF statement without nesting

Nanaia

Board Regular
Joined
Jan 11, 2018
Messages
235
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
I was shown once that there's a way to write an IF statement and list multiple criteria without having to write out multiple statements nested together. For example, IF cell E9 contains the numbers 1, 2, 3, 6, 9, or 12 then A9-0.103, if E9 doesn't contain those numbers then I'll continue with my nested statements. [ =IF(E9={1,2,3,6,9,12},A9-0.103,FALSE) ]. I thought you put { } around the several numbers you want the IF to check but it doesn't work. I get a #SPILL! error which tells me I'm doing it wrong. How do I do it correctly?
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

Toadstool

Well-known Member
Joined
Mar 5, 2018
Messages
1,464
Office Version
  1. 2016
Platform
  1. Windows
Hi Nanaia,

Try
=IF(OR(E9=1,E9=2,E9=3,E9=6,E9=9,E9=12),A9-0.103,FALSE)
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
56,856
Office Version
  1. 365
Platform
  1. Windows
You need to use OR like
Excel Formula:
=IF(OR(E9={1,2,3,6,9,12}),A9-0.103,FALSE)
 
Solution

Nanaia

Board Regular
Joined
Jan 11, 2018
Messages
235
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Using OR made it work the way I needed it to work. Thank you!
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
56,856
Office Version
  1. 365
Platform
  1. Windows
Glad we could help & thanks for the feedback.
 

Watch MrExcel Video

Forum statistics

Threads
1,130,137
Messages
5,640,332
Members
417,139
Latest member
madcabbie

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
Top