Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

FormCalc Formula to tell the difference between two time fields if they are populated - Help please

Avatar

Former Community Member


Hi,

I have a cell (TotalTime1) that references two other time formatted cells (Start1 and Finish 1).

The below formula is intended to tell the difference between the Start and Finish time if they are populated.

I had it working without the HasValue condition but the formula was calculating when there was no value in Start1 and Finish1 (due to time format).

This is the code I do have, it says there is an error near the last line; I am sorry if I post this in the wrong manner, I have not posted on this forum before but here goes:

if (HasValue (Finish1)  and HasValue (Start1)) then

if (Time2Num(Start1.formattedValue, "HH:MM") < Time2Num (Finish1.formattedValue, "HH:MM")) then

Abs (Time2Num(Start1.formattedValue, "HH:MM") - Time2Num(Finish1.formattedValue, "HH:MM")) / (60 * 60 * 1000)

else

24 - Abs (Time2Num(Finish1.formattedValue, "HH:MM") - Time2Num(Start1.formattedValue, "HH:MM")) / (60 * 60 * 1000)

endif


Any help would be appreciated.

Regards Fetachini

1 Accepted Solution

Avatar

Correct answer by
Level 7

you need another endif at the end (you have a nested if statement and only 1 endif)

View solution in original post

2 Replies

Avatar

Correct answer by
Level 7

you need another endif at the end (you have a nested if statement and only 1 endif)

Avatar

Former Community Member

Thanks whyisthisme,

Your speedy response is greatly appreciated, your support has resolved my issue.

Many thanks.


Regards

Fetachini