ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Formula for Between Dates (Excel 03) (https://www.excelbanter.com/excel-discussion-misc-queries/216510-formula-between-dates-excel-03-a.html)

Havenstar

Formula for Between Dates (Excel 03)
 
Hi,

I am looking for a formula that does the following. If =1/04/2009 and <=
1/31/2009 then P10 / If = 2/1/2009 and <= 2/28/2009 then P11.....

Any assistance is greatly appreciated.

Thank you,
Havenstar

Bernard Liengme

Formula for Between Dates (Excel 03)
 
You did not say what cell holds the date; I will use A1
=IF(and(A1 =DATEVALUE("1/04/2009",a1 <= DATEVALUE(1/31/2009),P10,IF(and(A1
=DATEVALUE("2/1/2009"),a1 <= DATEVALUE("2/18/2009"),P11,"x")

You can replace "x" by another IF to seven levels but it will get messy

This seems better =INDIRECT("P"&MONTH(A1)+9)
But it will give P10 for all days in Jan
Fix it with
=IF(A1DATEVALUE(1/03/2009),INDIRECT("P"&MONTH(A1)+9),"")
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Havenstar" wrote in message
...
Hi,

I am looking for a formula that does the following. If =1/04/2009 and <=
1/31/2009 then P10 / If = 2/1/2009 and <= 2/28/2009 then P11.....

Any assistance is greatly appreciated.

Thank you,
Havenstar




JBeaucaire[_90_]

Formula for Between Dates (Excel 03)
 
A few ways to do this. I noticed your formula for January didn't include the
whole month. To use specific dates like that, you could use an IF(AND:

=IF(AND(A10=DATE(2009,1,4),A10<DATE(2009,2,1)),P1 0,"not")

But if you can just allow the month alone as a check, you could try this:

=IF(MONTH(A11)=2,P11,"not Feb")

--
"Actually, I *am* a rocket scientist." -- JB

Your feedback is appreciated, click YES if this post helped you.


"Havenstar" wrote:

Hi,

I am looking for a formula that does the following. If =1/04/2009 and <=
1/31/2009 then P10 / If = 2/1/2009 and <= 2/28/2009 then P11.....

Any assistance is greatly appreciated.

Thank you,
Havenstar


Havenstar

Formula for Between Dates (Excel 03)
 
Thanks JB - I added an = to before the second date and it worked perfeclty.

Havenstar

"JBeaucaire" wrote:

A few ways to do this. I noticed your formula for January didn't include the
whole month. To use specific dates like that, you could use an IF(AND:

=IF(AND(A10=DATE(2009,1,4),A10<DATE(2009,2,1)),P1 0,"not")

But if you can just allow the month alone as a check, you could try this:

=IF(MONTH(A11)=2,P11,"not Feb")

--
"Actually, I *am* a rocket scientist." -- JB

Your feedback is appreciated, click YES if this post helped you.


"Havenstar" wrote:

Hi,

I am looking for a formula that does the following. If =1/04/2009 and <=
1/31/2009 then P10 / If = 2/1/2009 and <= 2/28/2009 then P11.....

Any assistance is greatly appreciated.

Thank you,
Havenstar


JBeaucaire[_90_]

Formula for Between Dates (Excel 03)
 
Careful there, I used Feb 1 as the cutoff, so I believe just a < is correct.
If you manually figure the last day of each month (ugh) then =<Jan 31 would
work, I just thought <Feb1 is less mental gymnastics.

Cheers.
--
"Actually, I *am* a rocket scientist." -- JB

Your feedback is appreciated, click YES if this post helped you.


"Havenstar" wrote:

Thanks JB - I added an = to before the second date and it worked perfeclty.

Havenstar

"JBeaucaire" wrote:

A few ways to do this. I noticed your formula for January didn't include the
whole month. To use specific dates like that, you could use an IF(AND:

=IF(AND(A10=DATE(2009,1,4),A10<DATE(2009,2,1)),P1 0,"not")

But if you can just allow the month alone as a check, you could try this:

=IF(MONTH(A11)=2,P11,"not Feb")

--
"Actually, I *am* a rocket scientist." -- JB

Your feedback is appreciated, click YES if this post helped you.



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

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