![]() |
If Function with Date
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 |
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(MONT H(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 "taxmom" wrote in message ... 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 |
OH, THANK YOU SOOO MUCH!
This is perfect! Have a great T.G.I.F Day! You just made my day! "Michael Malinsky" wrote: 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(MONT H(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 "taxmom" wrote in message ... 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 |
All times are GMT +1. The time now is 12:16 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com