Comparing two dates using between.

B

BerkshireGuy

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
 
M

matt

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.


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
 

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