ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Nested IFs (https://www.excelbanter.com/excel-worksheet-functions/198543-nested-ifs.html)

lwilliams

Nested IFs
 
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(O2 9="Open","Open",IF(O29="Closed",N29-D29," "))))

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

John C[_2_]

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

Hope this helps.
--
John C


"lwilliams" wrote:

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(O2 9="Open","Open",IF(O29="Closed",N29-D29," "))))

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


John C[_2_]

Nested IFs
 
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(O 29="Closed",MIN(N29-D29,1)," ",))))



--
John C


"lwilliams" wrote:

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(O2 9="Open","Open",IF(O29="Closed",N29-D29," "))))

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


lwilliams

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


"John C" wrote:

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(O 29="Closed",MIN(N29-D29,1)," ",))))



--
John C


"lwilliams" wrote:

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(O2 9="Open","Open",IF(O29="Closed",N29-D29," "))))

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


John C[_2_]

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


"lwilliams" wrote:

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


"John C" wrote:

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(O 29="Closed",MIN(N29-D29,1)," ",))))



--
John C


"lwilliams" wrote:

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(O2 9="Open","Open",IF(O29="Closed",N29-D29," "))))

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


Teethless mama

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

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


"John C" wrote:

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(O 29="Closed",MIN(N29-D29,1)," ",))))



--
John C


"lwilliams" wrote:

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(O2 9="Open","Open",IF(O29="Closed",N29-D29," "))))

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


John C[_2_]

Nested IFs
 
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.
--
John C


"Teethless mama" wrote:

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

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


"John C" wrote:

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(O 29="Closed",MIN(N29-D29,1)," ",))))



--
John C


"lwilliams" wrote:

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(O2 9="Open","Open",IF(O29="Closed",N29-D29," "))))

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



All times are GMT +1. The time now is 05:13 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com