Expression query

Hi,

Struggling with an amendment to an expressionโ€ฆ

This was my original expression:

IFS([Effective Date]<today(),โ€œAlready in effectโ€,(HOUR([Effective Date]-TODAY()) / 24)<=365,โ€œ1. Highly imminent: <12 Monthsโ€,(AND((HOUR([Effective Date]-TODAY()) / 24)>=365,(HOUR([Effective Date]-TODAY()) / 24)<(365+(365/2)))),โ€œ2. Moderately imminent: <18 Monthsโ€,(AND((HOUR([Effective Date]-TODAY()) / 24)>=(365+(365/2)),(HOUR([Effective Date]-TODAY()) / 24)<=(3652))),โ€œ3. Less imminent: <24 monthsโ€,(HOUR([Effective Date]-TODAY()) / 24)>(3652),โ€œEffective date >2 yearsโ€)

Iโ€™m trying to amend it to return a value of โ€œEffective Date not selectedโ€ if the field is left blank (I previously had it mandatory but new use case may leave it blank).

IFS

([Effective Date]="",โ€œEffective Date not selectedโ€),

(AND([Effective Date]<>"", [Effective Date]<today()),โ€œAlready in effectโ€,

(AND([Effective Date]<>"", (HOUR([Effective Date]-TODAY()) / 24)<=365)),โ€œ1. Highly imminent: <12 Monthsโ€,

(AND((HOUR([Effective Date]-TODAY()) / 24)>=365,(HOUR([Effective Date]-TODAY()) / 24)<(365+(365/2)))),โ€œ2. Moderately imminent: <18 Monthsโ€,(AND((HOUR([Effective Date]-TODAY()) / 24)>=(365+(365/2)),(HOUR([Effective Date]-TODAY()) / 24)<=(3652))),โ€œ3. Less imminent: <24 monthsโ€,(HOUR([Effective Date]-TODAY()) / 24)>(3652),โ€œEffective date >2 yearsโ€)

But then I noticed below the expression box the only text appearing is:
IFS( โ€ฆ(The value of column โ€˜Effective Dateโ€™) is equal to ("") โ€ฆโ€œEffective Date not selectedโ€)

Solved Solved
0 9 286
1 ACCEPTED SOLUTION

Hereโ€™s your expression reformatted to my preference:

IFS(
  ([Effective Date] = ""),
    โ€œEffective Date Not Selectedโ€,
  AND(
    ([Effective Date] <> ""),
    ([Effective Date] < TODAY())
  ),
    โ€œAlready in effectโ€,
  AND(
    ([Effective Date] <> ""),
    ((HOUR([Effective Date] - TODAY()) / 24) <= 365)
  ),
    โ€œ1. Highly imminent: <12 Monthsโ€,
  AND(
    ((HOUR([Effective Date] - TODAY()) / 24) >= 365),
    ((HOUR([Effective Date] - TODAY()) / 24) < (365 + (365 / 2)))
  ),
    โ€œ2. Moderately imminent: <18 Monthsโ€,
  AND(
    ((HOUR([Effective Date] - TODAY()) / 24) >= (365 + (365 / 2))),
    ((HOUR([Effective Date] - TODAY()) / 24) <= 3652)
  ),
    โ€œ3. Less imminent: <24 monthsโ€,
  ((HOUR([Effective Date] - TODAY()) / 24) > 3652),
    โ€œEffective date >2 yearsโ€
)

Iโ€™d change it to this (untested!):

IFS(
  ISBLANK([Effective Date]),
    โ€œEffective Date Not Selectedโ€,
  ([Effective Date] < TODAY()),
    โ€œAlready in effectโ€,
  ([Effective Date] < (EOMONTH(TODAY(), 11) + DAY([Effective Date]))),
    โ€œ1. Highly imminent: <12 Monthsโ€,
  ([Effective Date] < (EOMONTH(TODAY(), 17) + DAY([Effective Date]))),
    โ€œ2. Moderately imminent: <18 Monthsโ€,
  ([Effective Date] < (EOMONTH(TODAY(), 23) + DAY([Effective Date]))),
    โ€œ3. Less imminent: <24 monthsโ€,
  TRUE,
    โ€œEffective date >2 yearsโ€
)

See also:

View solution in original post

9 REPLIES 9

Steve
Platinum 4
Platinum 4

3X_3_e_3e953591f85b5649f91d7859d7b27d79ea6b01a2.png

@Steve - Iโ€™m sorry, Iโ€™m still not getting it

IFS(

ISBLANK([Effective Date]),โ€œEffective Date not selectedโ€,

(AND([Effective Date]<>"", [Effective Date]<today()),โ€œAlready in effectโ€,

(AND([Effective Date]<>"", (HOUR([Effective Date]-TODAY()) / 24)<=365)),โ€œ1. Highly imminent: <12 Monthsโ€,

(AND((HOUR([Effective Date]-TODAY()) / 24)>=365,(HOUR([Effective Date]-TODAY()) / 24)<(365+(365/2)))),โ€œ2. Moderately imminent: <18 Monthsโ€,

(AND((HOUR([Effective Date]-TODAY()) / 24)>=(365+(365/2)),(HOUR([Effective Date]-TODAY()) / 24)<=(3652))),โ€œ3. Less imminent: <24 monthsโ€,

(HOUR([Effective Date]-TODAY()) / 24)>(3652),โ€œEffective date >2 yearsโ€))

Error:
IFS function is used incorrectly:Inputs to IFS() must be one or more condition-value pairs.

So @Steve, I changed the formula, but even if I have a blank [Effective Date] this field returns the โ€œAlready in effectโ€ output

IFS

([Effective Date]="", โ€œEffective Date Not Selectedโ€,

AND([Effective Date]<>"", [Effective Date]<today()),โ€œAlready in effectโ€,

AND([Effective Date]<>"", (HOUR([Effective Date]-TODAY()) / 24)<=365),โ€œ1. Highly imminent: <12 Monthsโ€,

AND((HOUR([Effective Date]-TODAY()) / 24)>=365,(HOUR([Effective Date]-TODAY()) / 24)<(365+(365/2))),โ€œ2. Moderately imminent: <18 Monthsโ€,
AND((HOUR([Effective Date]-TODAY()) / 24)>=(365+(365/2)),(HOUR([Effective Date]-TODAY()) / 24)<=(3652)),โ€œ3. Less imminent: <24 monthsโ€,
(HOUR([Effective Date]-TODAY()) / 24)>(365
2),โ€œEffective date >2 yearsโ€
)

Hereโ€™s your expression reformatted to my preference:

IFS(
  ([Effective Date] = ""),
    โ€œEffective Date Not Selectedโ€,
  AND(
    ([Effective Date] <> ""),
    ([Effective Date] < TODAY())
  ),
    โ€œAlready in effectโ€,
  AND(
    ([Effective Date] <> ""),
    ((HOUR([Effective Date] - TODAY()) / 24) <= 365)
  ),
    โ€œ1. Highly imminent: <12 Monthsโ€,
  AND(
    ((HOUR([Effective Date] - TODAY()) / 24) >= 365),
    ((HOUR([Effective Date] - TODAY()) / 24) < (365 + (365 / 2)))
  ),
    โ€œ2. Moderately imminent: <18 Monthsโ€,
  AND(
    ((HOUR([Effective Date] - TODAY()) / 24) >= (365 + (365 / 2))),
    ((HOUR([Effective Date] - TODAY()) / 24) <= 3652)
  ),
    โ€œ3. Less imminent: <24 monthsโ€,
  ((HOUR([Effective Date] - TODAY()) / 24) > 3652),
    โ€œEffective date >2 yearsโ€
)

Iโ€™d change it to this (untested!):

IFS(
  ISBLANK([Effective Date]),
    โ€œEffective Date Not Selectedโ€,
  ([Effective Date] < TODAY()),
    โ€œAlready in effectโ€,
  ([Effective Date] < (EOMONTH(TODAY(), 11) + DAY([Effective Date]))),
    โ€œ1. Highly imminent: <12 Monthsโ€,
  ([Effective Date] < (EOMONTH(TODAY(), 17) + DAY([Effective Date]))),
    โ€œ2. Moderately imminent: <18 Monthsโ€,
  ([Effective Date] < (EOMONTH(TODAY(), 23) + DAY([Effective Date]))),
    โ€œ3. Less imminent: <24 monthsโ€,
  TRUE,
    โ€œEffective date >2 yearsโ€
)

See also:

@Steve This worked, thank you! And a much cleaner formula.
One more Q please.

When I select either โ€˜Effective Date is Knownโ€™ or โ€˜Effective Date is Estimatedโ€™ from the field [Effective Date Known] with label shown as โ€œIs the effective date known, estimated, or unknown?โ€, then the [effective date] field shows and then becomes required.

The user selects one of these options and then enters a date for [Effective Date].

Scenario:
User changes [Effective Date Known] to โ€˜Effective Date is Unknownโ€™, [Effective Date] is hidden but still holds the data value.

How would I clear that value (reset) upon the new dropdown selection option?

Unfortunately, thereโ€™s no way to clear the column value after the user has interacted with it and has not yet left the form. Once the user has interacted with the column value, automatic processing of that column stops. If you need the value cleared, you can add a Form Saved event action that clears the value when the user saves the form.

See also:

Perfect, will do.
Super helpful again

Thanks!

Ahhh, what if itโ€™s a column driven by a formula?
I can reset the effective date, but the [priority] is calculated as a result of the effective date and would still hold a value.

A column with an App formula expression will automatically recalculate whenever a non-virtual column of the row is changed.

Top Labels in this Space