ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Comparing two dates using between. (https://www.excelbanter.com/excel-programming/387967-comparing-two-dates-using-between.html)

BerkshireGuy

Comparing two dates using between.
 
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


matt

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



All times are GMT +1. The time now is 05:42 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com