Help

Formula If, date

Topic Labels: Formulas
1661 6
cancel
Showing results for 
Search instead for 
Did you mean: 
Matthieu_LABERI
6 - Interface Innovator
6 - Interface Innovator

Hi the community.
I have some difficulties with a formla.
I deliver package and i want to calcul the date of the preparation in relation to the delivery date decided by the customer
I want to calcul a date but this is conditionate with the result of a column.
Column A, i have a date : 12/04/2021
Column B, i have two type on result : “GLS” or “Chronopost”
This is what i want is :
If GLS = Date of the column A - 2 day.
With my example the result : 10/04/2021
If Chronopost = Date of the column A - 1 day.
With my example the result : 11/04/2021

Sorry for my english.
Could you help me please ?

Thank’s a lot,

Matthieu from www.lagreentouch.fr

6 Replies 6
augmented
10 - Mercury
10 - Mercury

Hi Matthieu. Maybe something like this…

IF({Column A},
DATEADD({Column A}, 
        SWITCH({Column B}, 'GLS', -2, 'Chronopost', -1),
        'days')
)

I haven’t tested this suggestion, but good luck!

Matthieu_LABERI
6 - Interface Innovator
6 - Interface Innovator

Thank’s a lot for your quick answer, it’s working !

To finish my process, i have juste another question :
If the date is TODAY, i want to add a result of a column with single select (for exemple column D).
Can i do that ?

Thank’s a lot for your precious help,

Matthieu

I’m guessing your attempt to mimick the above syntax didn’t work? That’s probably because the value in that single-select field is a string, not a number. So, just wrap the desired target in a VALUE() call to coerce it back. Though if these are all dates you’re dealing with, why not save yourself the trouble and reach into Airtable’s many niche formulae for handling dates? Most notably, the DATETIME_DIFF, DATETIME_PARSE, FROMNOW, TONOW, etc., depending on what exactly you’re trying to do.

Can you give us a little more information? When you say, “if the date is TODAY”, do you mean the date in {Column A}? Tell us what the values in the single select are, also.

Hi,
Thank’s for your email.
I have a date in a column.
If the day mentionned on this column is today, i want to write “YES” to another column. Is there a formula exist for this ? Thank’s a lot,
Matthieu

That sounds like a different question, but pretty easy to do. Replace “date column name” with the name of your column that holds the date.

IF(IS_SAME({date column name}, TODAY(), 'day'), 'YES')