# Help on a formula with dateDif() and a column of type "number"

Hi,
I have a table with “Payment_date” and “Days_to” (formula field) where {Days_to} is the number of days to the {Payment_date}.
This column would else show the days passed in a negative manner (-3).

This is my formula:
ifs({Payment_date} < today(), -dateDif({Payment_date}, today(), “D”), true(), dateDif(today(), {Payment_date}, “D”))

Let’s try it:

If today is 2022-06-13

2022-06-16 shows 3 day(s) left. OK!
2022-06-11 shows 0 day(s) left. KO… I’d expect -2

I think the problem is the `-dateDif({Payment_date}, today(), "D")` portion of the formula with the “-” in front. If I take away the minus, it works but of course the minus is lost.

I’m a little lost too

~P

PS Maybe a more flexible dateDif() would permit an easier formula. But this is another topic.

1 Like

Can you try `0 - dateDif({Payment_date}, today(), "D")`

Thanks @daniel.pan ! it works

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.