Upcoming database upgrades. Airtable functionality will be reduced for ~15 minutes at 06:00 UTC on Feb. 4 / 10:00 pm PT on Feb. 3. Learn more here

# Re: Function TODAY() not always giving the exact output when used with compare symbols "<" or ">" to compare dates

218 0
cancel
Showing results for
Did you mean:  5 - Automation Enthusiast

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?

3 Replies 3  8 - Airtable Astronomer

@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.  5 - Automation Enthusiast

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”))  8 - Airtable Astronomer

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'))````` 