Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

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

Fetachini
Level 1
Level 1


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
whyisthisme
Correct answer by
Level 7
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
whyisthisme
Correct answer by
Level 7
Level 7

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

View solution in original post

Fetachini
Level 1
Level 1

Thanks whyisthisme,

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

Many thanks.


Regards

Fetachini