+ Reply to Thread
Results 1 to 6 of 6

Sorting chart chronologically not alphabetically

  1. #1
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Leeds
    MS-Off Ver
    Microsoft Office 365
    Posts
    271

    Sorting chart chronologically not alphabetically

    Good afternoon,

    I hope everyone is in the best of health. I have attached my demo file. Problem: Data in the chart is sorted alphabetically not chronologically as shown in the original table.

    It looks like this on the sheet with the chart:
    Apr-Jun 18
    Apr-Jun 19
    Apr-Jun 20
    Apr-Jun 21

    I want my graph to have the same style or format as used in my main table or base table.

    What I want :

    Apr- Jun 18
    Apr-Jun 18
    Jul-Sep 18
    Jul-Sep 18

    I have already tried the manual way and it works but I am wondering if any better solution exists for this problem.

    Thank you in advance.
    Attached Files Attached Files

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,747

    Re: Sorting chart chronologically not alphabetically

    Two ideas. Both of them require you to re-do your data:

    1) Use actual dates instead of text strings to define your quarters, such as using the first day of the quarter (Date format in this example is US)

    Quarter
    Q Date
    Apr - Jun 18
    4/1/2018
    Apr - Jun 18
    4/1/2018
    Jul - Sep 18
    7/1/2018
    Jul - Sep 18
    7/1/2018
    Oct - Dec 18
    10/1/2018

    2) Use a string that sorts properly:
    Quarter
    Q String
    Apr - Jun 18
    2018 Q2
    Apr - Jun 18
    2018 Q2
    Jul - Sep 18
    2018 Q3
    Jul - Sep 18
    2018 Q3
    Oct - Dec 18
    2018 Q4
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Leeds
    MS-Off Ver
    Microsoft Office 365
    Posts
    271

    Re: Sorting chart chronologically not alphabetically

    Thanks a lot. How do I go about the first option? I know the basics of Excel. The Quarter column comes from another system. It's not manually entered. If you don't mind, would you please show me how to achieve this?

  4. #4
    Valued Forum Contributor
    Join Date
    03-24-2020
    Location
    Thailand
    MS-Off Ver
    Office 2016
    Posts
    897

    Re: Sorting chart chronologically not alphabetically

    Have a look at the attached file.
    As per above, you need actual dates to sort by date.
    One one is using some helper columns to derive a date from the text strings. then add these fields to your pivot table and sort accordingly.
    You then could 'hide' the helper columns if required.
    Attached Files Attached Files
    If your Question is answered; please mark it SOLVED. If you are happy with a member's solution, say 'Thanks' and click the 'Star' to Add Reputation.

  5. #5
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Leeds
    MS-Off Ver
    Microsoft Office 365
    Posts
    271

    Re: Sorting chart chronologically not alphabetically

    DATE("20"&RIGHT([@Quarter],2),VLOOKUP(LEFT([@Quarter],3),$K$2:$L$13,2,0),"1")
    Could you please explain the formula? I have heard of Vlookup but "[@Quarter] and ,$K$2:$L$13,2,0 part confusing me.
    Thank you so much for your help!

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,747

    Re: Sorting chart chronologically not alphabetically

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    [@Quarter] is a reference to the Quarter column in the table. This is called a structured reference (which you can google for more details). In this case it mean "the value in column Quarter that is in the same row as this formula".

    The format of VLOOKUP is (value, range, column[, approximate])

    value is the value to search for in the first column of range.
    column is the relative number of the column in range to retrieve the result from the same row where value was found.

    approximate is optional and defaults to TRUE. If it is FALSE then VLOOKUP will only look for an exact match. If it is TRUE and the data is sorted in ascending order, if VLOOKUP cannot find an exact match it will find the value closest to value without going over it. ("1" should not be used here since a boolean value is expected. In this case Excel will interpret "1" as FALSE but that is a bit convoluted when you can just use FALSE to begin with.)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Sorting Dates by month, chronologically, on Pivot Table
    By JustMax in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 02-13-2020, 04:17 AM
  2. [SOLVED] Sorting Chronologically dd/mmm/yy/hh/mm
    By bibu in forum Excel General
    Replies: 4
    Last Post: 12-27-2015, 06:33 PM
  3. Sorting assignments chronologically in a row
    By Panglossian in forum Excel General
    Replies: 2
    Last Post: 07-12-2015, 06:33 PM
  4. Sorting a list by its code Chronologically skipping first
    By darq in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-16-2014, 05:36 AM
  5. Sorting Column Alphabetically
    By red1975 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-26-2014, 12:10 PM
  6. Sorting certain sheets alphabetically
    By SOS in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-29-2008, 11:21 AM
  7. Sorting Alphabetically
    By Jack in forum Excel General
    Replies: 1
    Last Post: 01-15-2005, 05:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1