Dec 21, 2023 11:49 AM
Can someone help me figure out why the ‘else’ part of my IF statement isn’t working?
I'm trying to create a friendly date/time/timezone field IF a certain date field is not blank. That part is working. But if the date field is blank, I want it to put “N/A” in the new field. That part is returning an error.
Here is my formula.
IF(
{REQUESTED GO LIVE DATE} !=BLANK(),
DATETIME_FORMAT({REQUESTED GO LIVE DATE}, 'M/D/YY') & " at " & {REQUESTED GO LIVE TIME} & " " & {GO LIVE TIME ZONE}, "N/A"
)
I also tried it this way:
IF(
{REQUESTED GO LIVE DATE} !=BLANK(),
DATETIME_FORMAT({REQUESTED GO LIVE DATE}, 'M/D/YY') & " at " & {REQUESTED GO LIVE TIME} & " " & {GO LIVE TIME ZONE},
IF({REQUESTED GO LIVE DATE}=BLANK(),"N/A"
))
But neither formula is recognizing what to do if the REQUESTED GO LIVE DATE field is blank. Oddly, it is working when I remove the first part of the formula to only look for blank date field.
IF({REQUESTED GO LIVE DATE} = BLANK(),"N/A"
)
Attached is a screenshot of the results.
Solved! Go to Solution.
Dec 23, 2023 12:23 AM
Hi,
In short, you don't need to use BLANK() word, Just IF({Field}, [expression when Field not empty] , [output when Field is blank] ). The last can be omitted, default is blank, so IF ({Field} , [expression] ) also works.
Dec 21, 2023 04:39 PM
Hey @bmcad1116,
Try this formula:
TRIM(
IF(
{REQUESTED GO LIVE DATE},
DATETIME_FORMAT(
{REQUESTED GO LIVE DATE},
'M/D/YY'
)
& IF(
{REQUESTED GO LIVE TIME},
' at '
)
)
&
IF(
AND(
{REQUESTED GO LIVE DATE},
{REQUESTED GO LIVE TIME}
),
{REQUESTED GO LIVE TIME} & IF(
{GO LIVE TIME ZONE},
' ' & {GO LIVE TIME ZONE}
)
)
)
Dec 23, 2023 12:23 AM
Hi,
In short, you don't need to use BLANK() word, Just IF({Field}, [expression when Field not empty] , [output when Field is blank] ). The last can be omitted, default is blank, so IF ({Field} , [expression] ) also works.