Help

Re: Formula connected to Single Select Field

1330 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Emma_Roeder
5 - Automation Enthusiast
5 - Automation Enthusiast

Hi Everyone,

I’m trying to write a formula to calculate the length of service for our volunteers based on a single select field with options Active/Inactive. I’ve gotten the formula to return a result for Active volunteers, but for the Inactive volunteers it remains empty.
Here’s the formula, how do I get a result for the Inactive volunteers?

IF({Active/Inactive}=“Active”,DATETIME_DIFF(TODAY(),{Start Date},‘days’,IF({Active/Inactive}=“Inactive”,DATETIME_DIFF({End Date},{Start Date},‘days’))))

2 Replies 2
Utility_Locator
6 - Interface Innovator
6 - Interface Innovator

Looks like you may have a parentheses in the wrong spot, try this:

IF({Active/Inactive}=“Active”, DATETIME_DIFF(TODAY(),{Start Date},‘days’), IF({Active/Inactive}=“Inactive”,DATETIME_DIFF({End Date},{Start Date},‘days’)))

As an alternate solution, the formula can be simplified a bit using SWITCH, if only by making the parenthesis-placement issue a little easier because you’re not nesting so much:

SWITCH({Active/Inactive}, "Active", DATETIME_DIFF(TODAY(),{Start Date},'days'),
    "Inactive", DATETIME_DIFF({End Date},{Start Date},‘days’))