SOLVED

sorting dates

%3CLINGO-SUB%20id%3D%22lingo-sub-3333338%22%20slang%3D%22en-US%22%3Esorting%20dates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3333338%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%20i%20have%20a%20list%20of%20dates%20where%20an%20activity%20(installation)%20occurred...and%20I%20would%20like%20to%20build%20a%20graph%20showing%20the%20volume%20of%20installations%20per%20day%20-%20across%20a%20period%20of%20several%20years.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ee.g.%20over%20several%20years%20installations%20were%20done%20each%20day...sometimes%20more%20than%201%20in%20a%20day...in%20this%20case%20there%20would%20be%20two%20separate%20occurencees%20of%20that%20date%20because%20there%20was%202%20installations.%20See%20below%20there%20are%202%20dates%20for%2025th.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eas%20such...%3C%2FP%3E%3CTABLE%20width%3D%22149%22%3E%3CTBODY%3E%3CTR%3E%3CTD%20width%3D%22149%22%3EInstalled%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E08%2F08%2F2017%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E04%2F09%2F2017%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E06%2F09%2F2017%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E25%2F09%2F2017%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E25%2F09%2F2017%3C%2FTD%3E%3C%2FTR%3E%3C%2FTBODY%3E%3C%2FTABLE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20would%20like%20to%20see%20this%20in%20a%20graph%20so%20i%20can%20visually%20represent%20the%20busiest%20periods.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhen%20I%20take%20this%20list%20and%20create%20a%20pivot%20table%2C%20and%20then%20create%20a%20line%20graph....the%20graph%20is%20too%20wide%20(as%20it%20covers%20several%20years)...so%20i%20opted%20for%20a%20monthly%20rate....converting%20the%20dates%20into%20Year_Month%20format%2C%20as%20follows%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CTABLE%20width%3D%22190%22%3E%3CTBODY%3E%3CTR%3E%3CTD%20width%3D%22190%22%3EInstall%20Month_Year%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E2017August%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E2017September%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E2017September%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E2017September%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E%3CP%3E2017September%3C%2FP%3E%3C%2FTD%3E%3C%2FTR%3E%3C%2FTBODY%3E%3C%2FTABLE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHowever%20now%20when%20i%20create%20a%20pivot%20table%20-%20to%20show%20how%20many%20occurred%20in%20September...it%20sorts%20the%20dates%20alphabetically....e.g.%202017August%20would%20be%20followed%20by%202017December.%26nbsp%3B%20%26nbsp%3BThen%20my%20line%20graph%20is%20not%20running%20in%20date%20order.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%20my%20question%20is%20-%20how%20do%20I%20resort%20the%20pivot%20table%20so%20it%20is%20back%20in%20date%20order....ro%20is%20there%20an%20entirely%20better%20way%20of%20doing%20this%20in%20the%20first%20place!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAny%20help%20appreciated.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDen.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3333338%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3333417%22%20slang%3D%22en-US%22%3ERe%3A%20sorting%20dates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3333417%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F666832%22%20target%3D%22_blank%22%3E%40Fitzpad123%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20table%20that%20you%20displayed%20is%20text%2C%20and%20so%20Excel%20is%20doing%20its%20job%20correctly%20when%20it%20sorts%20alphabetically.%3C%2FP%3E%3CTABLE%20width%3D%22190%22%3E%3CTBODY%3E%3CTR%3E%3CTD%20width%3D%22190%22%3EInstall%20Month_Year%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E2017August%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E2017September%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E2017September%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E2017September%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E%3CP%3E2017September%3C%2FP%3E%3C%2FTD%3E%3C%2FTR%3E%3C%2FTBODY%3E%3C%2FTABLE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou%20need%20to%20make%20sure%20your%20dates--the%20dates%20you%20use%20as%20the%20horizontal%20axis%20in%20your%20Pivot%20Table--%20are%20actual%20Excel%20dates.%20It%20should%20seamlessly%20give%20you%20the%20ability%20to%20collapse%20those%20into%20months%2C%20and%20do%20them%20sequentially%20in%20calendar%20order%20rather%20than%20alphabetical%20order.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

Hi, i have a list of dates where an activity (installation) occurred...and I would like to build a graph showing the volume of installations per day - across a period of several years.

 

e.g. over several years installations were done each day...sometimes more than 1 in a day...in this case there would be two separate occurencees of that date because there was 2 installations. See below there are 2 dates for 25th.

 

as such...

Installed
08/08/2017
04/09/2017
06/09/2017
25/09/2017
25/09/2017

 

I would like to see this in a graph so i can visually represent the busiest periods.

 

When I take this list and create a pivot table, and then create a line graph....the graph is too wide (as it covers several years)...so i opted for a monthly rate....converting the dates into Year_Month format, as follows:

 

Install Month_Year
2017August
2017September
2017September
2017September

2017September

 

However now when i create a pivot table - to show how many occurred in September...it sorts the dates alphabetically....e.g. 2017August would be followed by 2017December.   Then my line graph is not running in date order.  

 

So my question is - how do I resort the pivot table so it is back in date order....ro is there an entirely better way of doing this in the first place!

 

Any help appreciated.

 

Den.

 

 

 

 

 

10 Replies

@Fitzpad123 

 

This table that you displayed is text, and so Excel is doing its job correctly when it sorts alphabetically.

Install Month_Year
2017August
2017September
2017September
2017September

2017September

 

You need to make sure your dates--the dates you use as the horizontal axis in your Pivot Table-- are actual Excel dates. It should seamlessly give you the ability to collapse those into months, and do them sequentially in calendar order rather than alphabetical order.

 

@Fitzpad123 

I guess "2017August" is the text, and texts are sorted alphabetically. You may format dates as "yyyy mmmm" and use them as dates.

thank you sergei and mathetes. Makes sense....I didnt realise pivot sorted alphabetically. So I need to take original date (01/02/22) and convert it into month format, but still in date? could you advise what formular i use to do that please? you are correct, I used =text2 before because I thought that would be best way to show the months...but Im happy also if it shows the month in number format.
I dont seem to be able to find this can you advise please?

If I highlight a DATE and choose format cells, I dont see any options that only show month and year...they all include the day of month



@Fitzpad123 

 

Excel is pretty smart. I have a spreadsheet in which I have a huge data table consisting of all my financial transactions (checks, credit card charges, deposits, whatever). Each row has a date, standard Excel "Short date" format....mo/da/yr .... and my pivot table pretty much assumes I want it to take those very detailed rows of information and display the income and expense categories by month. (The months are the horizontal axis; categories of income/expense are the vertical axis; I have year set as a Filter, since I usually display just a single year's worth of data.....

 

So my main point, you should be able to just use the normal natural full date, and let Excel do its thing. If that doesn't work, if you're seeing too much daily detail, then add a column for month and year (still using Excel's formatting of real underlying dates)

thank you - i think i follow...but i dont know how to convert my full date into a month_year version
best response confirmed by Hans Vogelaar (MVP)
Solution

@Fitzpad123 

 

See the attached file. The data table has full dates displayed. The pivot table summarizes by month.

@Fitzpad123 

 

My point so far is that you won't need to format by month and year. Pivot Table is smart enough to provide that option automatically, working from a full date field in the underlying data. 

 

Nevertheless, if you want to display a real Excel date solely as Month-Year, it's available under "More Number Formats"    -- the first dialog box looks like this

mathetes_0-1651849372228.png

In the next dialog box, select Date and then scroll down along the many options until you find the one that is Month and Year only

mathetes_1-1651849481173.png

 

@mathetes I see - I was making it more complicated/harder! thanks again....Ive now got what I need - much appreciated!

 

Fitzpad123_0-1651850260655.png

 

@Fitzpad123 

 

I was making it more complicated/harder!

 

Yes indeed. That's easy to do. We all do it from time to time, over-think things. As a general rule of thumb, I've come to the realization (and recommend it as a good habit of mind to you as well): "If I think Excel really ought to do ___________________" then the chances are that it DOES. The clever people who've programmed Excel have thought the same and have made it possible. The trick--and this can take some time--is finding where they buried it. Or, in this case, where it's lying right out there in the open and just works like you want it to, without drawing attention to itself.

 

thanks again....Ive now got what I need - much appreciated!

 

You're very welcome.