ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Sorting by month and year and ignoring the day (https://www.excelbanter.com/excel-discussion-misc-queries/158370-sorting-month-year-ignoring-day.html)

charles

Sorting by month and year and ignoring the day
 
I often need to sort a worksheet by month first then by one or two other
columns, my problem is that excel takes the day of the month into account. Is
it possible to do this sort only by the month and year only and ignoring the
day of the month? BTW I would prefer not using a pivot table.

Peo Sjoblom

Sorting by month and year and ignoring the day
 
It sorts by year first, then month and finally by day, you could use 2 help
columns
assume the list starts in A2

in B2 put


=YEAR(A2)

In C2 put


=MONTH(A2)


Select both cells and copy down as long as needed

select all 3 columns and select the order you want to sort by

--


Regards,


Peo Sjoblom




"Charles" wrote in message
...
I often need to sort a worksheet by month first then by one or two other
columns, my problem is that excel takes the day of the month into account.
Is
it possible to do this sort only by the month and year only and ignoring
the
day of the month? BTW I would prefer not using a pivot table.




Dave Peterson

Sorting by month and year and ignoring the day
 
I'd use a helper column with a formula like:

=text(a1,"mm-yyyy")
or
=text(a1,"yyyy-mm")

sort by month then year (or by year, then month???).

Charles wrote:

I often need to sort a worksheet by month first then by one or two other
columns, my problem is that excel takes the day of the month into account. Is
it possible to do this sort only by the month and year only and ignoring the
day of the month? BTW I would prefer not using a pivot table.


--

Dave Peterson


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

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