I’m trying to use the IF and DATEADD formulas to calculate a Project Start Date based on whether or not a Launch Date is entered for a record. If there is no Launch Date entered, the record field should be left blank.
Here is the formula:
IF({LAUNCH DATE} = BLANK(), “”, DATEADD({LAUNCH DATE}, -16,‘week’))
What I am getting is a date string (2021-10-18T00:00:00.000Z) instead of the Friendly Date format.
There are two important things to remember when using Airtable’s IF() function:
If you include an empty string as one of the arguments, Airtable will force the other output to be a string as well. That’s why the date looks so odd in your original example, @S_Pacheco-Williams
The final argument in the IF() function is optional. If you omit it, Airtable will return nothing. In that light, it’s almost never necessary to include an empty string (which introduces the problem mentioned in #1) or the BLANK() function.
Also know that you can test virtually any field for being full/empty without using the BLANK() function. Just put the field reference itself. If the field has any data, Airtable treats it as True (or truthy in coding circles); if it’s empty, it’s equivalent to False (or falsy).
With all that in mind, your original formula can be rewritten like this:
You might also run into slight discrepancies because dates are stored internally relative to GMT. To ensure that the date is correct for your local timezone, use this variant (spread out for easier reading; you can safely copy and paste this into the formula field and it will still work):