Applying a different sum depending on the value of a certain cell

Hi

Hopefully you can help me please.

I need to add either 90 days or 180 days to a date (for this example say this date is in cell A2). 

Whether I add 90 or 180 days depends on the value of another cell in the row (in say A1) eg: if A1=1, I need to +90 days to the date in A2; if A1=2, I need to +180 days to the date in A2.

I want the answer to this to be given in cell A3

I’ve formatted the cells A2 & A3 into date format. And I know that to +90 (or 180) days I just need to do =A2+90 (or 180)

I’ve also found out that to ignore cells without a date I need to use:

=IF(A2<>””,A2+90,””)

It’s the either or part that I can’t figure out.

Any help would be greatly appreciated

3 thoughts on “Applying a different sum depending on the value of a certain cell

  1. Excel Geek

    Hello there

    You were very close! Try this formula…

    =IF(AND(A1=1,B1<>""),B1+90,IF(AND(A1=2,B1<>""),B1+180,""))

    What this does is combine everything you wanted into a nested IF statement.

    IF(AND(A1=1,B1<>""),
    So, first check to see if A1 contains a 1 AND that B1 is NOT blank. If both these result in TRUE then progress to adding 90 to the date, B1+90

    But, if the above results in a FALSE then progress to
    IF(AND(A1=2,B1<>""),
    Again, make sure that A1 contains a 2 AND B1 is NOT blank. If this results in TRUE then add 180 to the date, B1+180

    Lastly, if both the first and second set of conditions are FALSE (that is there is neither a 1 or 2 in cell A1 and B1 IS blank) then don’t enter anything into the cell, making it blank… ""))

    =IF(AND(A1=1,B1<>""),B1+90,IF(AND(A1=2,B1<>""),B1+180,""))

    I hope this helps!

    Thanks for using the website!

  2. Chris

    Brilliant! Thanks for that, I really appreciate the help. I wasn’t expecting such a quick response. Thanks again.

  3. Excel Geek

    No problem, happy to help.

    If required, please use the site again and recommend to other people.

    Many thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *