Microsoft Microsoft excel 2007 (pc)

I need to create a formula in which one cell contains a value (1, 2, 3, 4, or 5). Based on that value, another cell containing a date will add either 30 or 60 days. 1 = 30

2:5 = 60I've started with the following formula: =IF(I4=1, F4+30). This works.

When I add the following - it breaks: =IF((I4=1, F4+30), IF(I4=2:5, F4=60))

Any help would be appreciated!

2:5 is not a syntax that Excel can recognize. You have a few choices.

If your criteria is fairly simple, e.g. only the integers 1 - 5 will ever appear in I4, then your criteria is actually 1 or not 1:

=IF(I4=1, F4+30, F4+60)

If you really need to check for the specific values, then try this:

=IF(I4=1, F4+30, IF(OR(I4=2, I4=3, I4=4, I4=5), F4+60, ""))

This might even work for you...

=IF(I4=1, F4+30, IF(AND(I4>1, I4<6), F4+60, ""))

Click Here Before Posting Data or VBA Code --->How To Post Data or Code.

Thanks. They both worked perfectly!!! I appreciate the help!

I have a similar issue, If a cell contains the letter "Y" for yes, then I need to multiply a different cell by .01. I know I've done this before but at my advanced age I can't remember how?

Ask Your Question

Weekly Poll

Do you agree with Google's decision to shut down Google+?

Discuss in The Lounge

Poll History