Formula with functionality similar to SWITCH


Is there some equivalent of SWITCH formula (available in Excel/Airtable)?


I am building custom dropdown for a date range (last day, last 7, last month, custom). Based on this I would push back the start range by so many days.

I just figured out a work-around:
I will insert the number of days as the value in the Dropdown. If the value form dropdown == “custom” I will trigger the visibility of custom date selection fields.

Anyway original question still might be helpful - would there be a formula with similar functionality to SWITCH?

There’s no SWITCH atm but you could string some IF's and DEFAULT to something.

1 Like

Also, you can use the LOOKUP formula and a custom object:

LOOKUP({last_day: 1, last_7: 7, last_month: 30, custom: -1}, pageVars.selectedValue)

If pageVars.selectedValue is last_7, the formula would evaluate to 7 etc.

In this case though the value is better applied as part of the dropdown options list itself. However, for e.g. labels it makes sense!

@Harri_Sarsa - cool that is creative, yes this formula and using an object , gives same functionality as SWITCH.

This will actually save me from multiple IF formulas via flow components later.