Nested IFs

L

lwilliams

I am using nested IFs to determine the number of days between two events. If
the two events occurred on the same day, how do I return a 1 instead of 0 and
not affect the calculation for other date ranges?

The current statement is

=IF(O29="Void","Void",IF(O29="Spare","Spare",IF(O29="Open","Open",IF(O29="Closed",N29-D29," "))))

where n29 is date opened and d29 is date closed and o29 is the status
Thanks
 
J

John C

=IF(O29="Void","Void",IF(O29="Spare","Spare",IF(O29="Open","Open",IF(O29="Closed",MIN(N29-D29,1)," "))))

Hope this helps.
 
J

John C

You could get rid of some of the nested IFs as well, by the following
=IF(OR(O29="Void",O29="Spare",O29="Open"),O29,IF(O29="Closed",MIN(N29-D29,1)," ",))))
 
L

lwilliams

Wow, I really like the second statement. I guess you can tell I'm only a
hack at this. Thanks for the help.
 
J

John C

We all are, thanks for the feedback.
--
John C


lwilliams said:
Wow, I really like the second statement. I guess you can tell I'm only a
hack at this. Thanks for the help.
 
T

Teethless mama

You have two too many of these ")"
the formula can be reduce further

=IF(OR(O29={"Void","Spare","Open"}),O29,IF(O29="Closed",MIN(N29-D29,1)," ",))
 
J

John C

Whew! Saved 5 characters there. Nevermind the crux of it is eliminating as
many IF statements as possible, I guess those extra 5 characters will give me
time to do my taxes, get my laundry done, and feed the cats.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top