IF MONTH STATEMENT WITH MULTIPLE VALID OPTIONS

Ronboy

New Member
Joined
May 2, 2022
Messages
4
Office Version
  1. 2013
Platform
  1. Windows
I'm trying to construct an IF statement based on the MONTH where there can be multiple valid months.
I currently have the following statement which works, but I'd like to find a more compact alternative:
IF(OR(MONTH(A1)=4,MONTH((A1)=7,MONTH(A1)=9,MONTH(A1)=11),1,0)
Perhaps something like the following (which I could not get working):
IF(MONTH(A1)={4,7,9,11},1,0)
Any help would be greatly appreciated.
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
=IF(Or(MONTH(A1)={4,7,9,11}),1,0)
Thanks! And if I wanted to store that list of months in a single cell (A2) which I could then reference in your IF statement, how would I go about doing that?
 
Upvote 0
Random_rows.xlsm
A
102/02/2022
21,4,7,11,12
30
40
Sheet1
Cell Formulas
RangeFormula
A3A3=IF(ISNUMBER(FIND(","&MONTH(A1)&",",","&A2&",")),1,0)
A4A4=COUNT(FIND(","&MONTH(A1)&",",","&A2&","))
 
Upvote 0
Random_rows.xlsm
A
102/02/2022
21,4,7,11,12
30
40
Sheet1
Cell Formulas
RangeFormula
A3A3=IF(ISNUMBER(FIND(","&MONTH(A1)&",",","&A2&",")),1,0)
A4A4=COUNT(FIND(","&MONTH(A1)&",",","&A2&","))
That doesn't sound helpful. What I was hoping for what something like:
=IF(OR(MONTH(A1)=A2),1,0) where A2 contained {4,7,9,11} in some form.
 
Upvote 0
The value in A2 is a string, not an array, so it doesn't work.
 
Upvote 0

Forum statistics

Threads
1,214,588
Messages
6,120,412
Members
448,960
Latest member
AKSMITH

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