Help

Re: 5 DATES compare with today

Solved
Jump to Solution
1462 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Victor_Miranda
5 - Automation Enthusiast
5 - Automation Enthusiast

Hello, forgive my English, I’m Brazilian and I’m having difficulties with the use of the IF command.

First, I have 5 different dates, which I will use as a review in the studies, and I needed to compare all these dates at once with the current day, so if date 1 is less than today, date 1 would return to me, if it were bigger i would return date 2, however, if date 2 was smaller, i would return date 3, and so on.

Does anyone have any idea how to do this?

!

1 Solution

Accepted Solutions
Mohamed_Swella1
13 - Mars
13 - Mars

Hi @Victor_Miranda,

Welcome to Airtable Community! :grinning_face_with_big_eyes:

First of all, your English is fine , no worries there!

So tell me, are the dates in 5 different fields? If so, then you need something like

IF(Datetime_diff(Today(), {Date 1}, 'days')<0, {Date 1}, IF(Datetime_diff(Today(), {Date 2}, 'days'), {Date 2}))

Is that what you are looking for?

BR,
Mo

See Solution in Thread

4 Replies 4
Mohamed_Swella1
13 - Mars
13 - Mars

Hi @Victor_Miranda,

Welcome to Airtable Community! :grinning_face_with_big_eyes:

First of all, your English is fine , no worries there!

So tell me, are the dates in 5 different fields? If so, then you need something like

IF(Datetime_diff(Today(), {Date 1}, 'days')<0, {Date 1}, IF(Datetime_diff(Today(), {Date 2}, 'days'), {Date 2}))

Is that what you are looking for?

BR,
Mo

Hello Mohamed, thank you for answering me, the code you sent me worked very well for the first 3 dates, now my question would be how to add the other two.

Answering your question, yes, the dates are in different fields. I tried to increase the code as shown below but it didn’t work.

IF(DATETIME_DIFF(TODAY(), {R - 2}, ‘days’)<0, {R - 2}, IF(DATETIME_DIFF(TODAY(), {R - 2}, ‘days’), {R - 3})
IF(DATETIME_DIFF(TODAY(), {R - 3}, ‘days’), {R - 4})
IF(DATETIME_DIFF(TODAY(), {R - 4}, ‘days’), {R - 5}))

Since {R - x} is the date that number x, do you have any idea what I did wrong?

Again, THANKS for the awnser!!!

Heyyy, realy thanks, changing the code i have sucess.

IF(DATETIME_DIFF(TODAY(), {R - 2}, ‘days’)<0, {R - 2}, IF(DATETIME_DIFF(TODAY(), {R - 3}, ‘days’)<0, {R - 3}, IF(DATETIME_DIFF(TODAY(), {R - 4}, ‘days’)<0, {R - 4}, IF(DATETIME_DIFF(TODAY(), {R - 5}, ‘days’)<0, {R - 5} ))))

This what i do, thankyou ! realy!!!

Glad i can help :slightly_smiling_face:

Add date 1 too , cant see it in your final formula