# Re: How to use the Switch formula for greater than, lesser than criteria?

Solved
Jump to Solution
1603 1
cancel
Showing results for
Search instead for
Did you mean:
7 - App Architect

Hi,

I’m trying to get familiar with the SWITCH formula by taking a shot at using it instead of a nested IF but can’t seem to figure out the following.

I have a field called “Expiry Date” (type Date) and another field called “Expired?”, which is a formula field where I’m trying to use the SWITCH formula. My goal is that the “Expired?” field formula should output “Expired” if the “Expiry Date” is lesser than TODAY(); it should output “Expires today” if the “Expiry Date” equal to TODAY(); and should output “Still Active” if the "Expiry Date is greater than TODAY().

The formula I’m using is

SWITCH({Expiry Date},<TODAY(),"Expired",=TODAY(),"Expires Today", >TODAY()"Still Active","N/A")

I’m definitely doing something wrong because I’m getting a formula error.

Can somebody please help me with this.

Thanks,
Sean

1 Solution

Accepted Solutions
18 - Pluto

You’ll need to use a nested IF formula, because that’s not how the SWITCH function works. The SWITCH function only allows one expression, and then you list a static set of results to choose from.

2 Replies 2
18 - Pluto

You’ll need to use a nested IF formula, because that’s not how the SWITCH function works. The SWITCH function only allows one expression, and then you list a static set of results to choose from.

7 - App Architect

Ah, got it. Thanks, Scott. Appreciate it.