ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Sort Date Column (https://www.excelbanter.com/excel-worksheet-functions/248907-sort-date-column.html)

Cal

Sort Date Column
 
I have a date column in the yyyy-mm-dd format. I want the user to be able to
sort the worksheet by month. Is there a way I can pull only the month from
the date field and allow the user to sort on that and have the worksheet
display all rows that fall within that month.
Example May - all columns with a date of 2009-05-01 through 2009-05-31 would
display.

PS - I am running Excel 2002

Jacob Skaria

Sort Date Column
 
With data as wuch; if you do the normal sort what happens?

If this post helps click Yes
---------------
Jacob Skaria


"CAL" wrote:

I have a date column in the yyyy-mm-dd format. I want the user to be able to
sort the worksheet by month. Is there a way I can pull only the month from
the date field and allow the user to sort on that and have the worksheet
display all rows that fall within that month.
Example May - all columns with a date of 2009-05-01 through 2009-05-31 would
display.

PS - I am running Excel 2002


Michael.Tarnowski

Sort Date Column
 
Hi Cal,
use a helper column and fill it with values extracted either by MONTH
() - if your date column values are in date format, or by FIND(), MID
() - if values are in text/string format. You can hide the helper
column and use a suitable control element for switching between
ascending/descending sorting.

HTH, have a nice day
Michael


CAL wrote:
I have a date column in the yyyy-mm-dd format. I want the user to be able to
sort the worksheet by month. Is there a way I can pull only the month from
the date field and allow the user to sort on that and have the worksheet
display all rows that fall within that month.
Example May - all columns with a date of 2009-05-01 through 2009-05-31 would
display.

PS - I am running Excel 2002


Ashish Mathur[_2_]

Sort Date Column
 
Hi,

Try this

1. Select the date column and go to Format cells (Ctrl+1). In Number
Category Custom Type enter mmmm. Instead of dates, all months will
appear.
2. Now select the range once again (including the header row) and go to Sort
Options. In the drop down select January, February, March

3. Select ascending order
4. All the dates will now be sorted by month
5. Select the date column and go to Format cells (Ctrl+1). In Number
Category Custom Type enter dd-mm-yyyy. Instead of months, all dates
will appear sorted by month

Hope this helps.

--
Regards,

Ashish Mathur
Microsoft Excel MVP
www.ashishmathur.com

"CAL" wrote in message
...
I have a date column in the yyyy-mm-dd format. I want the user to be able
to
sort the worksheet by month. Is there a way I can pull only the month
from
the date field and allow the user to sort on that and have the worksheet
display all rows that fall within that month.
Example May - all columns with a date of 2009-05-01 through 2009-05-31
would
display.

PS - I am running Excel 2002




All times are GMT +1. The time now is 11:45 AM.

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