If Function with Date

T

taxmom

Hello everyone,

I need a formula that states:

If (d1 (which is a date format) = January 2005,then return b10,if(d1 date =
February, then return b11,otherwise return 0)).

I have tried several ways, my formula does not seem to acknowledge the date
value. What am I doing wrong?

Any suggestions?
Thanks
 
M

Michael Malinsky

The problem is that you are trying to compare apples and oranges. If you
have a date in a cell, no matter what the format, there is always a month,
day and year component. So if you want to see if a date, for example,
January 10, 2005, is in January 2005, then you have to break down the date
to check only the month and year components, such as:

=IF(AND(MONTH(D1)=1,YEAR(D1)=2005),B10,IF(AND(MONTH(D1)=2,YEAR(D1)=2005),B10
,0))

Make sure there are no line breaks after you copy this into your formula bar
or it will not work.

HTH
 
T

taxmom

OH, THANK YOU SOOO MUCH!

This is perfect!

Have a great T.G.I.F Day! You just made my day!
 

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