+ Reply to Thread
Results 1 to 9 of 9

sorting problem w/ pivot table

  1. #1
    Registered User
    Join Date
    07-03-2013
    Location
    Texas
    MS-Off Ver
    Excel 2007
    Posts
    37

    sorting problem w/ pivot table

    Hi all,

    I am trying to make a pivot table, and I wanted to sort by values instead of the row labels. The sorting seems to work for the most part, but a couple of entries seem to be off. I have attached the file, and I hope that someone will be able to help me.

    In the DATA tab, it has the information I wanted to make into a pivot table. In the TABLE tab, it's the result of some macro written to display the pivot table. I've highlighted the 2 entries I believe to be not sorted correctly in this table. Row label "16D" and "17F" need to be farther down the list.

    For instance, "16D" should be above "17A", and "17F" should just be the last row of the table. I am not sure why the sorting function is weird. Also, please check out the VBA code to see if I did anything wrong.

    Thanks in advance!!
    Attached Files Attached Files
    Last edited by jyl7; 07-22-2013 at 02:13 PM. Reason: forgot the attachment

  2. #2
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: sorting problem w/ pivot table

    If I sort the table manualy I get the right result.

    See the attached file.


    Please Login or Register  to view this content.
    Probably the failure is on this row.

    You don't select the whole table for sorting, so column A will be not sorted that way.
    Attached Files Attached Files
    Last edited by oeldere; 07-22-2013 at 02:40 PM. Reason: added the code line
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  3. #3
    Registered User
    Join Date
    07-03-2013
    Location
    Texas
    MS-Off Ver
    Excel 2007
    Posts
    37

    Re: sorting problem w/ pivot table

    I don't quite understand.

    I want to sort by the values in "BEGIN".

    In the example you sent back to me, it's just sorted by column A values, which isn't what I needed unfortunately.

  4. #4
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: sorting problem w/ pivot table

    I get an faillure on this row if I want to run your macro.

    Please Login or Register  to view this content.
    You have to define which "begin" => you got 4 of them, needs to be sorted and in which order.

    That also affects the sorting in column A.

  5. #5
    Registered User
    Join Date
    07-03-2013
    Location
    Texas
    MS-Off Ver
    Excel 2007
    Posts
    37

    Re: sorting problem w/ pivot table

    hmm, that is weird. I don't get that error when I run that macro.

    There are actually 5 begins, but I didn't specify which to sort. I assumed that this pivot table would just sort each sample by "begin" and then the rows labels will just move themselves.

    To be clear, I don't want to sort column A. I want to sort columns B, D, F, etc.

    The rows labels won't ever change its order for any given sample, i.e. 13A is always before 13B. In sample 1, 13A is always before 13B, and B will never come before A in samples 2, 3, 4 -- if 13A or 13B exist at all in those samples.


    If pivot table is not the way to go, do you have any suggestions about how to create such a table?

  6. #6
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: sorting problem w/ pivot table

    Please Login or Register  to view this content.
    That is what will be done.

    But thats why i ask you wich begin has to be sorted.

    1) Just the first

    2) of all the colums with begin

    3) and in what order they need to be sorted.

    That's a general question (it has nothting to do with the pivot table solution) which you have to answer, before you can test if the values are sorted well.

  7. #7
    Registered User
    Join Date
    07-03-2013
    Location
    Texas
    MS-Off Ver
    Excel 2007
    Posts
    37

    Re: sorting problem w/ pivot table

    I guess if it needs specifying, then sort from 0 to max of first begin column, then the 2nd begin column, and 3rd, and so forth.

  8. #8
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: sorting problem w/ pivot table

    And if you do that manualy, how the data in column A are sorted?

  9. #9
    Registered User
    Join Date
    07-03-2013
    Location
    Texas
    MS-Off Ver
    Excel 2007
    Posts
    37

    Re: sorting problem w/ pivot table

    The data in column A should just match up with the order of all the other data columns.

    For instance.

    Column 1-2 are as follows:

    A-1
    B-3
    C-5
    D-7
    F-9

    If I have a Column 3:
    A-2
    B-3
    C-5
    D-8
    E-10


    Then my columns 1-2-3 would look like:
    A-1-2
    B-3-3
    C-5-5
    D-7-8
    E- -10
    F-9-


    So, basically, I want it to know to insert the row "E" while doing the Column 3 sorting before row "F" which was already in the original Columns 1-2 data.

+ 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. Pivot table- sorting with value filter problem
    By Masun in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 06-02-2013, 03:55 AM
  2. Excel 2007 : Problem sorting names in pivot table
    By jmhassett in forum Excel General
    Replies: 3
    Last Post: 04-21-2013, 05:33 PM
  3. Problem sorting Pivot Table grouped by week
    By casker in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 08-23-2012, 12:59 PM
  4. Regarding Pivot table sorting problem
    By ramki in forum Excel General
    Replies: 3
    Last Post: 08-06-2009, 02:36 AM
  5. Pivot table (calculation and/or sorting) problem
    By jringo in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-12-2008, 09:38 AM

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