View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
matt matt is offline
external usenet poster
 
Posts: 73
Default Comparing two dates using between.

On Apr 23, 7:17 am, BerkshireGuy <berkshireguy2005-
wrote:
I have some data where each row has a date in the format of 20050101,
20060423, etc.

I wanted to create a pivot of this data, but have groups depending on
which date range they fall under.

From other projects, I figured the best way to do this is have a new


column called date group and then having a comparision to indicate
which group it falls under.

I first need to reformat the date as 01/01/2005 and then do a between
comparision - i.e. Between 01/01/2005 and 03/01/2005 would get placed
the 01/01/2005 - 03/01/2005 group.

I'm assuming something with date serial?

Any ideas?

Thanks,
Brian


Assuming that a sample date is in cell A1, you could use the following
function:

=DATE(LEFT(A1,4),MID(A1,5,2),RIGHT(A1,2))

Matt