Skip to main content

If and DateAdd statement giving me an error


Ok so I am trying to use an if statement to put in a date but then if it doesn’t meet the condition I want it to be blank. I keep getting an error. Here is my formula: IF({Sample Status} = Out, (DATEADD({Date Checked Out},7,“days”)), BLANK())

Can anyone help?
Thanks

2 replies

Forum|alt.badge.img+16
  • Inspiring
  • 532 replies
  • May 23, 2022

Hi @Dyanna_Garcia
You can just remove the BLANK() from your formula. You may also need to tell the formula that Out is a string by surrounding it in ‘’

IF({Sample Status} = 'Out', (DATEADD({Date Checked Out},7,'days')))

Forum|alt.badge.img+12

Hi @Dyanna_Garcia !
Assuming ‘Out’ is a a value and not a name of a field, then this should do it:

IF({Sample Status}='Out', DATEADD({Date Checked Out},7,'days'))

If ‘Out’ is a name of a field, then use this:

IF({Sample Status}={Out}, DATEADD({Date Checked Out},7,'days'))

You rarely need to use BLANK(). IF statements work as

IF({condition is true},
'do this',
'otherwise do that'
)

If you don’t require an output when conditions aren’t met, such as BLANK(), it’s preferable to leave the ‘otherwise do that’ part out entierly. It’s cleaner and helps prevent possible future issues with empty strings.

IF({condition is true},
'do this'
)

Reply