Upcoming database upgrades. Airtable functionality will be reduced for ~15 minutes at 06:00 UTC on Feb. 4 / 10:00 pm PT on Feb. 3. Learn more here

# Re: IF with multiple conditions

Solved
Jump to Solution
144 0
cancel
Showing results for
Search instead for
Did you mean:
6 - Interface Innovator

I feel like I’m close with this one, but it’s not quite working.

I want to show quarters of the year, so if a column equals “January 2021”,“February 2021”, “March 2021”, I want it to show “January - April 2021”, and so on for each quarter. I’ve attempted it with IF(OR), but it’s not working. Appreciate any tips here.

`IF(OR({Result Month/Year}="January 2021","February 2021", "March 2021"),"January-April 2021",IF(OR({Result Month/Year}="April 2021","May 2021", "June 2021"),"April-June 2021"))`

1 Solution

Accepted Solutions
18 - Pluto

The problem with your formula is with your `OR` condition. Each entry in the `OR` should be a complete comparison.

Instead of …

`OR({Result Month/Year}="January 2021","February 2021", "March 2021")`

you need …

``````OR(
{Result Month/Year}="January 2021",
{Result Month/Year}="February 2021",
{Result Month/Year}="March 2021"
)
``````

However, if you have access to an original date field, try this formula. It will work with any year

``````SWITCH( DATETIME_FORMAT({date field}, 'Q'),
"1", "January - March " & YEAR({date field}),
"2", "April - June " & YEAR({date field}),
"3", "July - September " & YEAR({date field}),
"4", "October - December " & YEAR({date field})
)
``````
2 Replies 2
18 - Pluto

The problem with your formula is with your `OR` condition. Each entry in the `OR` should be a complete comparison.

Instead of …

`OR({Result Month/Year}="January 2021","February 2021", "March 2021")`

you need …

``````OR(
{Result Month/Year}="January 2021",
{Result Month/Year}="February 2021",
{Result Month/Year}="March 2021"
)
``````

However, if you have access to an original date field, try this formula. It will work with any year

``````SWITCH( DATETIME_FORMAT({date field}, 'Q'),
"1", "January - March " & YEAR({date field}),
"2", "April - June " & YEAR({date field}),
"3", "July - September " & YEAR({date field}),
"4", "October - December " & YEAR({date field})
)
``````
6 - Interface Innovator

That’s awesome thanks :grinning: