View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
theo theo is offline
external usenet poster
 
Posts: 66
Default IF calculation using dates - brain hurts

Yahoo! Now I can enjoy the beautiful day outside.
Thanks Joel!!
T

"JoeU2004" wrote:

"Theo" wrote:
It doesn't work because the from Date is 8/4/2009 and the date
I'm checking is Aug-2009 (which Excel is reading as 8/1/2009).
Somehow I need the check to be against just the month and year,
but I can't figure out how to do that.


Assuming you are looking for an Excel formula solution, not VBA, one
approach is:

=if(date(year(A1),month(A1),1) = date(year(A2),month(A2),1),"same
month/year","not same month/year")

Note: You can avoid one of the DATE functions if you want to assume that
the cell is always mm/1/yyyy, as Aug-2009 is. In that case:

=if(A1 = date(year(A2),month(A2),1), "same...", "not same...")


----- original message -----

"Theo" wrote in message
...
It doesn't work because the from Date is 8/4/2009 and the date I'm
checking
is Aug-2009 (which Excel is reading as 8/1/2009).
Somehow I need the check to be against just the month and year, but I
can't
figure out how to do that. OR I need to do some type of LOOKUP where Aug
2009 is a series of dates between 8-1 and 8-31 and the from date just has
to
be one of them. But I'm struggling with that one too.
Thanks Don

"Don Guillett" wrote:

Where f13 is the from date and f14 is the to date and f15 is the date to
check.
=IF(AND(F15$F$13,F15<=$F$14),"Yes","No")

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Theo" wrote in message
...
I have a date range:
From:8/5/2009
To: 11/19/2009

I have Month/Year Column and then a Result Column; in the Result
Column I
need a formula that will determine if the month and year is within the
above
date range.
Jul 09 Formula should return No
Aug 09 Formula should return Yes

Any suggestions?
Thanks
T