Aug 07, 2023 09:51 AM
I'm trying to do some math and get some totals of columns, but I have div/0 errors.
The following formula calculates work days and prints the result from a "StartDate" and a "FinishDate" column.
Aug 07, 2023 02:42 PM
Hey @Jarrod_Lilly!
Give this a shot:
IF(
AND(
{EstFinish},
{EstStart}
),
DATETIME_DIFF(
{EstFinish},
{EstStart},
'days'
)
-
DATETIME_DIFF(
{EstFinish},
{EstStart},
'days'
) / 7
+
IF(
DATETIME_FORMAT(
{EstStart},
'E'
)
>
DATETIME_FORMAT(
{EstFinish},
'E'
),
1,
0
)
* 2 + 1
)
It's worth noting that I haven't had a chance to test this, but the only functional difference is that I've nested your original formula within an IF function that utilizes an AND function to evaluate whether both your date fields return data.
If that AND function returns true, then your original formula will be evaluated, otherwise the formula will return undefined, and therefore blank.
I removed the INT() function you had nested in your original formula, as the DATETIME_DIFF() function already returns whole integers.