Avatar of Taras
Taras
Flag for Canada asked on

Pivot table month sort order

I have date Column named Month formatted as "02/11/2009". In a separate column I use a =text(cell,"MMM-YY") formula to get the dates into a month format so "02/11/2009" becomes "Feb-09" in the new column. However, when I create a pivot table, it sorts the "MMM-YY" alphabetically instead of chronologically,
How to sort it properly?
Microsoft Excel

Avatar of undefined
Last Comment
Taras

8/22/2022 - Mon
Rob Henson

Rather converting to text, use a function to round the date to the end/beginning of the month:

End of month
=EOMONTH(cell,0)

Beginning of Month
=EOMONTH(cell,-1)+1

The numerical parameter is the number of months to add to the date. Adding 0 months just rounds to the end of the month; -1 months rounds back to previous month end and then adding 1 to the result gives the first of the next month.

Format the result as "mmm-yy" and you will see the same result but the dates will then sort in order as expected.

Thanks
Rob H
Rob Henson

Alternatively, I know there is a function, but not sure how to do it, where you can group data such as dates in a Pivot Table so that you still see only the one column per month rather than a column for each day of the month.

You then wouldn't need the extra column at all.

Thanks
Rob H
Taras

ASKER
Rob where to put those functions??
How to apply them? ..In source data column  or in pivot area?
 Is that used with  separate new column or existing one?
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
Rob Henson

Use instead of your text conversion.
Taras

ASKER
Both of them in one cell?
Taras

ASKER
For not being  excel expert , Can you give me example?
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
Rob Henson

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Taras

ASKER
Thanks a lot