I am trying to create a formula for if a cell is blank than do this but if not blank then do that.

Erin 20 Reputation points
2025-12-11T15:29:23.58+00:00

This is what I have but it is not working, it comes up with a #VALUE.

=IF(ISBLANK($O2),

IF(ISBLANK($J2), "", TODAY()-$J2),

IF(ISBLANK($J2), "", $O2-$J2)
Microsoft 365 and Office | Excel | For business | Windows
0 comments No comments
{count} votes

Answer accepted by question author
  1. Q&A Assist
    2025-12-11T15:29:33.8733333+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    The formula you provided has a structure that could lead to a #VALUE! error if the references or calculations are not handled correctly. Here’s a revised version of your formula that should work without returning a #VALUE! error:

    =IF(ISBLANK($O2),
        IF(ISBLANK($J2), "", TODAY()-$J2),
        IF(ISBLANK($J2), "", $O2-$J2)
    )
    

    Key Points to Check:

    1. Cell References: Ensure that $O2 and $J2 are correctly referencing the intended cells.
    2. Date Calculations: If $J2 contains a date, ensure it is formatted properly as a date. If it is blank, the formula will return an empty string.
    3. Formula Structure: Make sure that the parentheses are correctly matched and that there are no additional characters or spaces that could cause issues.

    If you still encounter issues, consider checking the values in $O2 and $J2 to ensure they are as expected, and that they do not contain any errors themselves.


    References:

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.