# If, then statement in Excel

Solved/Closed
Kim - Feb 18, 2010 at 06:45 AM
Fergie - Feb 3, 2012 at 09:53 AM
Hello,

This formula sounds easy to come up with, but I cannot figure it out. I'm trying to figure out how to add a certain amount of days to a date from one cell within another cell, if the third cell has either one text or another.

So here's exactly what it looks like. Cell a1=travel start date, b1=Leave or pass, c1=return date

I want Cell c1 to automatically add either 21 (leave) or 10 (pass) days to cell a1 and show the return date based on cell b1 being either leave or pass. Seems simple, but I'm at a lost for getting the cell b1 criteria in the formula.

I would appreciate any help. Thanks.

## 3 responses

rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Feb 18, 2010 at 06:57 AM
Assumptions
1. A1 is a date
2. If a1 or b1 is blank, then nothing is to be seen in c1
3. If b1 is neither Leave or Pass nor blank, then show in c1 same date as a1

Put this in c1 and format the c1 to be a date in the format that you desire/

=IF(OR(A1="",B1=""),"",A1+IF(B1="Leave",21,IF(B1="Pass",10,0)))
YES!! It worked. Thank you rizvisa1. You don't know how much time you have saved a Soldier for the next 10 months.
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Feb 18, 2010 at 09:27 AM
Glad to know that I could help some one. Stay safe.
Thanks. I was using an IF-ERROR statement in Office 2010 and when I saved it to an earlier version it didn't recognize the formulas. I changed the IF-ERROR formulas to IF-OR-THEN and everything worked fine even though it said I might have compatibility issues when saving to the earlier version.