Formula connected to Single Select Field

#1

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

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’)))

1 Like
Formula based on Single Select Field question
#3

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’))
1 Like