Skip to main content
Solved

IF Formula fail

  • June 6, 2025
  • 7 replies
  • 88 views

lwetherby
Forum|alt.badge.img+3
I think this formula
 
IF({Last Deployment} = 'MM/DD/YY', 'MM/DD/YY', "*")
 
says:
 
IF (the value of the field Last Deployment is a date, show the date, otherwise pop in an asterisk (instead of #ERROR!))
 
But what I’m getting now is either an  * or #ERROR! - pretty much the opposite of what I am trying to accomplish.
 
Help!

Best answer by BuildForAT

No worries! Thanks for clarifying.

In that case, you can use this formula in your new formula field:
 

IF(ISERROR({Last Deployment}), "*", {Last Deployment})

Since {Last Deployment} is already a string we don’t need to do DATETIME_FORMAT like I originally suggested.

If you would like to fix {Last Deployment} directly, that’s possible but the formula gets a bit ugly!

Also, may I ask why you’re using Arrayslice here instead of a Rollup field like this:
 

 

You can use the MAX function to get the latest date (if that’s what you’re aiming for)
 

7 replies

BuildForAT
Forum|alt.badge.img+6
  • Brainy
  • June 6, 2025

Hey ​@lwetherby,

 

Agreed: the #ERROR! is not very appealing.

 

Are you looking to accomplish something like this?

 

If so, I think you want the following formula:

IF(Date, DATETIME_FORMAT(Date, "MM/DD/YY"), "*")

 

To explain what the formula does, it first checks if `Date` is empty or not.

If it is NOT empty, then it will format the date with the “MM/DD/YY” specifier (you can learn more about the function here: https://support.airtable.com/docs/supported-format-specifiers-for-datetime-format).

If it IS empty, then it will return the asterisk.

 

I hope this helps!


Taha-Jiruwala
Forum|alt.badge.img+9

The issue is that you're comparing {Last Deployment} to the text string 'MM/DD/YY', which doesn't make sense if {Last Deployment} is a date field. That comparison will never be true, and worse, if {Last Deployment} is empty or invalid, Airtable might throw an error depending on how the rest of the formula is interpreted.

Here's the correct formula

IF(
{Last Deployment},
DATETIME_FORMAT({Last Deployment}, 'MM/DD/YY'),
"*"
)


In this formula, {Last Deployment} by itself in the condition checks whether there’s a value in that field. If there is, DATETIME_FORMAT({Last Deployment}, 'MM/DD/YY') converts the date into a readable string. If there’s no date, the formula returns "*" instead.

Taha, Airtable Advisor


Mike_AutomaticN
Forum|alt.badge.img+28

Hey! I agarre with ​@BuildForAT. However, for further reference, is Last Deployment date or lookup field? 


lwetherby
Forum|alt.badge.img+3
  • Author
  • New Participant
  • June 9, 2025

We’re not there yet - sorry, I marked ​@BuildForAT’s answer best, but then it turned out not to work - when I plugged it in, I was still getting either a date or #ERROR!

Maybe I should just try to fix this formula, which is currently returning either a date or #ERROR! - this is where the data/date in the {Last Deployment} field is coming from:

DATETIME_FORMAT(ARRAYSLICE({Last Last Day BOG (from Link to Forms)}, 1, 1), 'MM/DD/YY')
 
If it makes a difference {Last Last Day BOG (from Link to Forms)} is a look up field.
 
I think I need to add an IF somewhere - but I’m not sure where.
 
Thank you!

BuildForAT
Forum|alt.badge.img+6
  • Brainy
  • Answer
  • June 9, 2025

No worries! Thanks for clarifying.

In that case, you can use this formula in your new formula field:
 

IF(ISERROR({Last Deployment}), "*", {Last Deployment})

Since {Last Deployment} is already a string we don’t need to do DATETIME_FORMAT like I originally suggested.

If you would like to fix {Last Deployment} directly, that’s possible but the formula gets a bit ugly!

Also, may I ask why you’re using Arrayslice here instead of a Rollup field like this:
 

 

You can use the MAX function to get the latest date (if that’s what you’re aiming for)
 


lwetherby
Forum|alt.badge.img+3
  • Author
  • New Participant
  • June 9, 2025

That’s great! Using a Rollup with the MAX(values) function fixed my Last Last Day field, so I don’t need my Last Deployment field (which was trying to fix my Last Last Day field).

I did plug your formula into my Last Deployment field before I realized that - the dates looked like this: 2025-07-18T00:00:00.000Z. ouch 😂

Also - instead of an #ERROR!, I’m getting nothing - which is much preferred!

Thanks for all your help.

~Lisa


BuildForAT
Forum|alt.badge.img+6
  • Brainy
  • June 9, 2025

Yes, sometimes it’s best to give the full context so we can give you the best solution at any point in the pipeline.

 

Awesome that the Rollup field worked!