# DateTime_Diff formula with three different possibilities

Topic Labels: Formulas
Solved
1046 4
cancel
Showing results for
Did you mean:
5 - Automation Enthusiast

Hello-

I’d like to create a formula that allows me to track expiration dates status (three possibilities):

1. Due soon, but not within four weeks (blank value in table);
2. Due within four weeks (“Yes”);
3. Past due (“Late”)

I’ve been able to create this with the first two status items, but not the third (“Late”). Here’s what I have:

IF(
AND(
DATETIME_DIFF({Expiration}, NOW(), “days”) < 28,
DATETIME_DIFF({Expiration}, NOW(), “days”) > 0
), “Yes”
)

Thanks!

1 Solution

Accepted Solutions

agh it has :face_with_symbols_over_mouth: smart quotes in it. you need to retype all the quotes. see if this works, if not just literally delete the quotes and retype them.

IF(AND(DATETIME_DIFF({Expiration}, NOW(),‘days’)<28,
DATETIME_DIFF({Expiration}, NOW(), ‘days’)>0),‘YES’, IF(DATETIME_DIFF({Expiration},NOW(),‘days’)<0,‘LATE’))

4 Replies 4
9 - Sun

you need something that says like

IF(AND(

DATETIME_DIFF({Expiration}, NOW(),‘days’)<28,

DATETIME_DIFF({Expiration}, NOW(), ‘days’)>0),‘YES’, IF(DATETIME_DIFF({Expiration},NOW(),‘days’)<0,‘LATE’))

5 - Automation Enthusiast

Hmm. This is giving me an error, but I’ll see if I can tweak it. Thank you!!

agh it has :face_with_symbols_over_mouth: smart quotes in it. you need to retype all the quotes. see if this works, if not just literally delete the quotes and retype them.

IF(AND(DATETIME_DIFF({Expiration}, NOW(),‘days’)<28,
DATETIME_DIFF({Expiration}, NOW(), ‘days’)>0),‘YES’, IF(DATETIME_DIFF({Expiration},NOW(),‘days’)<0,‘LATE’))

5 - Automation Enthusiast

Worked like a charm. Thank you thank you thank you.