Help

Upcoming database upgrades. to improve our reliability at 03:30 UTC on Feb. 25 / 7:30pm PT on Feb. 24. Some users may briefly experience slow load times or error messages. Learn more here

DATETIME_DIFF Formulas Help Needed! Negative Numbers

Topic Labels: Formulas
Solved
Jump to Solution
319 10
cancel
Showing results for 
Search instead for 
Did you mean: 

Why are all my DATETIME_DIFF formulas coming up as a negative number?

My formula is: DATETIME_DIFF({Birthday}, TODAY(), ‘years’) and I am getting for example -29 instead of 29.

1 Solution

Accepted Solutions
Penny_Bell
5 - Automation Enthusiast
5 - Automation Enthusiast

I figured it out it didn’t like the curly braces.

Used: DATETIME_DIFF(TODAY(), Birthday, ‘years’)

Thank you!

See Solution in Thread

10 Replies 10

Because TODAY() needs to go first. Formula documentation is here:

I tried that, but I get the error message.

Using: DATETIME_DIFF(TODAY(),{Birthday},‘years’)

Are you using the correct quotation marks?

DATETIME_DIFF(TODAY(),{Birthday},'years')

Yup… I also have the same issue with this formula (getting a negative number).

DATETIME_DIFF({Check-in}, {Check-out},‘days’)

Once again, you’re doing it incorrectly. As I explained above, you need to put the later date first, not the earlier date first.

If you’re getting an error message, than please explain what error message you’re getting and please give a screenshot to go with it.

You’re not giving enough information for us to help you. We can’t just guess what sort of error you’re getting.

Ok, so it worked with this formula putting the date first: DATETIME_DIFF({Check-out}, {Check-in}, ‘days’).

But for this formula: DATETIME_DIFF(TODAY(),{Birthday},‘years’) and DATETIME_DIFF(TODAY(), {Birthday}, ‘years’)
I got the attached error message.
Screen Shot 2022-08-23 at 7.45.54 AM
Screen Shot 2022-08-23 at 7.51.13 AM

It’s because, as @Mohamed_Swellam pointed out above, you are using stylized quotation marks around the word years. Airtable only recognizes straight quotes, not curly quotes.

Strange - they have worked for other formulas just fine.

Penny_Bell
5 - Automation Enthusiast
5 - Automation Enthusiast

I figured it out it didn’t like the curly braces.

Used: DATETIME_DIFF(TODAY(), Birthday, ‘years’)

Thank you!

No, the curly braces had nothing to do with it. It was the quotation marks that were the problem.