If and statements with multiple conditions

cruzin1957

New Member
Joined
Mar 6, 2011
Messages
5
Conditions that may occur

A1 = 11/20/2010
A2 = 3/11/2011
A3 = 31 (result needed in number of days)

OR

A1 = 11/20/2010
A2 = 12/20/2010
A3 = 20 (result needed in number of days)

OR

A1 = 11/20/2010
A2 = blank - no date
A3 = 31 (result needed in number of days)

Results needed: I need to complete an if/and statement that will look at both cells A1 and A2 and determine the number of days in December that occurred. I am not having any luck getting this to work. Thanks!
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Conditions that may occur

A1 = 11/20/2010
A2 = 3/11/2011
A3 = 31 (result needed in number of days)

OR

A1 = 11/20/2010
A2 = 12/20/2010
A3 = 20 (result needed in number of days)

OR

A1 = 11/20/2010
A2 = blank - no date
A3 = 31 (result needed in number of days)

Results needed: I need to complete an if/and statement that will look at both cells A1 and A2 and determine the number of days in December that occurred. I am not having any luck getting this to work. Thanks!

Try something like...

A3:

=IF(COUNT(A1:A2)=2,A2-A1,"")

Format the formula cell as General.
 
Upvote 0
Thanks for the reply, but that is not giving me the desired result. I also need to add one more condition:

A1 - 3/1/2011
A2 - Blank
A3 - 0 (results in number of days

Because 3/1/2011 is after December 31, the result should be 0.
 
Upvote 0
Thanks for the reply, but that is not giving me the desired result. I also need to add one more condition:

A1 - 3/1/2011
A2 - Blank
A3 - 0 (results in number of days

Because 3/1/2011 is after December 31, the result should be 0.

I see...

Control+shift+enter, not just enter:

=IF(A1,SUM((TEXT(ROW(INDIRECT(A1&":"&IF(A2,A2,TODAY()))),"mmm")="Dec")+0),"")

Does this satisfy? Note that if A2 is empty, today's date is used.
 
Upvote 0
This works absolutely awesome . . . except . . . when the date is 2010. For example, if the start date is 1/25/2010 and I am calculating the number of days in March 2011, the answer comes up to 62 days instead of 31. This string is calculating March twice (2010 and 2011).

Thank you so much for your help!
 
Upvote 0
This works absolutely awesome . . . except . . . when the date is 2010. For example, if the start date is 1/25/2010 and I am calculating the number of days in March 2011, the answer comes up to 62 days instead of 31. This string is calculating March twice (2010 and 2011).

Thank you so much for your help!

So A1: 1/25/2010 and A2: ?

How does one know what you are calculating with just what are in A1 and A2?
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,519
Messages
6,179,263
Members
452,902
Latest member
Knuddeluff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top