IF formula questions


#1

Hi, I would like to construct the following statement:
If {check 1} is filled in with a date, then return the value of 10 days after the date of check 1
If {check 1} is blank, then leave the current cell blank

The following is what I’ve tried, would appreciate some suggestions.

IF({check 1} is not blank,(DATEADD{check 1},10,'date), ())

Thanks in advance!


#2

Try

IF(
    {Check 1},
    DATEADD(
        {Check 1},
        10,
        'days'
        ),
    BLANK()
    )

Or, if you prefer a non-indented version:

IF({Check 1},DATEADD({Check 1},10,'days'),BLANK())

(Either can be copy-and-pasted into your formula field.)

You don’t need to declare explicitly {Check 1}!=BLANK(), as IF({Check 1}… contains an implied ‘is not a blank|empty|null’ value. I seem to recall instances where an explicit comparison ran afoul; for instance, when Field='' (that is, an empty string), IF(Field=BLANK() might confusingly evaluate to FALSE under some circumstances, but TRUE under others. (Admittedly, other of my mistakes may have caused the error — but the abbreviated version always evaluates as one expects.)

Similarly, strictly speaking, the final BLANK() isn’t necessary; you could delete it and the comma after DATEADD(). I go back and forth on this question; lately, though, I’ve tended to leave it in, mainly because, 10 months from now, should I have reason to revisit the code, it will take me a few seconds less to figure out what it does.

And make sure your unit specifier is 'days' or 'd'. DATEADD() might match the ‘d’ in 'date' and be happy; then, again, it might not.


#3

@W_Vann_Hall

Thank you SO MUCH!!!
It worked beautifully, and I appreciate the explanation - I feel feel a bit smarter now :slight_smile: