Nov 24, 2022 01:57 AM
Hi!
I had the following situation when using the following formula to compare dates and determine the current row as the current date.
the first part state if the count I less or equal to 1, that’s the current row,
then if the count is above 1 and now is greater than the start date and now is previous to next date or next date is empty, that’s the current row
IF({Count}<=1, “current”, IF(AND({Count}>1, Now() > {Start date}, OR(Now() < {Next date}, {Next date}=“”)),“current”))
This would give the correct output.
But when I tried using instead of NOW() > TODAY()
IF({Count}<=1, “current”, IF(AND({Count}>1, {TODAY()} > {Start date}, OR(TODAY() < {Next date}, {Next date}=“”)),“current”))
It would throw a completely different result, completely shift on dates.
WHY?
Nov 24, 2022 05:42 AM
@Christian_Heins It seems there is a mistake in the second formula:
IF({Count}<=1, “current”, IF(AND({Count}>1, {TODAY()} > {Start date}, OR(TODAY() < {Next date}, {Next date}=“”)),“current”))
Function TODAY() should not be placed in curly braces as they denote the field name.
Nov 24, 2022 05:47 AM
Sorry the formula I used was without the braces on today:
IF({Count}<=1, “current”, IF(AND({Count}>1, TODAY() > {Start date}, OR(TODAY() < {Next date}, {Next date}=“”)),“current”))
Nov 24, 2022 06:25 AM
The difference is because TODAY() is set at midnight and NOW() shows the current time.
I slightly modified your formula to distinct different CURRENTS.
IF({Count}<=1, 'current', IF(AND({Count} > 1, TODAY() > {Start date}, OR(TODAY() < {Next date}, {Next date} = '')),'current 2','current 3'))```