+ Reply to Thread
Results 1 to 13 of 13

Help! Excel 2010 is not sorting correctly

  1. #1
    Registered User
    Join Date
    09-18-2013
    Location
    USA
    MS-Off Ver
    2010
    Posts
    29

    Help! Excel 2010 is not sorting correctly

    Hi, I am unable to sort correctly in my report. Can someone please help me figure out what is going on ?
    I have attached a sample spreadsheet. Column A lists the Items and column B lists the % that should be associated with that item.
    I have column C set as =A2,=A3 and so on, so that it pulls the item name into it. I did this in order to recreate the sorting issue I have with the main report.
    In column D, have copy and pasted the %s from column B.

    Now, I select cell C1 through Cell D8, then click sort, then select that I have headers. I then choose to sort by 'Percent', largest to smallest. When I do this, excel sorts the 'Percent' column but does not sort the Items in column C with the Percent, even though they were selected in the sort range. I have never seen this before.

    Excel sorting issue sample.xlsx

    This is the correct alignment of % to Item.
    Item Percent
    Item 1 72.73%
    Item 2 95.73%
    Item 3 85.80%
    Item 4 98.44%
    Item 5 98.11%
    Item 6 41.18%
    Item 7 95.24%

    After sorting those cells, it looks like thisand the Item is not correctly aligned to the %.
    Item Percent
    Item 1 98.44%
    Item 2 98.11%
    Item 3 95.73%
    Item 4 95.24%
    Item 5 85.80%
    Item 6 72.73%
    Item 7 41.18%

    All Item cells are formatted as general or text and all percent cells are formatted as percentage 2 decimal.

    Thanks!

  2. #2
    Forum Expert
    Join Date
    12-11-2011
    Location
    Netherlands
    MS-Off Ver
    office 365
    Posts
    3,654

    Re: Help! Excel 2010 is not sorting correctly

    Take a look at this.
    The table is automatic sorterd
    Attached Files Attached Files
    Willem
    English is not my native language sorry for errors
    Please correct me if I'm completely wrong

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Help! Excel 2010 is not sorting correctly

    Instead of =A2 etc, use this, copied down...
    =INDEX($A$2:$A$8,MATCH(D2,$B$2:$B$8,0))

    and instead of copy/paste values to get the data to sort, try his, copied down...
    =SMALL($B$2:$B$8,ROWS($A$1:A1))

    edit: must be an echo in here. popip used LARGE() to sort big to small, I used SMALL to sort small to big - take your pick
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Registered User
    Join Date
    09-18-2013
    Location
    USA
    MS-Off Ver
    2010
    Posts
    29

    Re: Help! Excel 2010 is not sorting correctly

    Hi guys, thanks for the quick responses. I guess my sample may not have been the best sample. In the main report, all the data is coming from other formulas.
    I am attaching a much better sample. All the data is on the 'MTD By Account' tab, and I am trying to do sorting on the 'MTD By Upline' tab.

    Excel Sorting issue sample1.xlsx
    In column A we have the Items.
    Column B uses this formula: =SUMIF('MTD By Account'!$A:$E,'MTD By Upline'!$A2,'MTD By Account'!$C:$C)
    Column C uses this formula: =SUMIF('MTD By Account'!$A:$E,'MTD By Upline'!$A2,'MTD By Account'!$D:$D)
    Column D uses this formula: =B2-C2
    Column E uses this formula: =D2/B2

    I am trying to sort by column E and keep everything aligned correctly.
    The purpose is to sort the chart.

    In the main report, all the data on the 'MTD By Account' tab is pulled from other sources using formulas. For this sample I have only included values.
    This is a better example, after you sort you will see that some of the items are also moved, although still not aligned with the % or the cell ref in the formula. The %s are not even sorted in the correct order.
    Before sorting:
    Item Users Not logged in Logged in %
    Item 1 847 231 616 72.73%
    Item 2 937 40 897 95.73%
    Item 3 176 25 151 85.80%
    Item 4 257 4 253 98.44%
    Item 5 264 5 259 98.11%
    Item 6 34 20 14 41.18%
    Item 7 21 1 20 95.24%

    After sorting:
    Item Users Not logged in Logged in %
    Item 4 21 1 20 95.24%
    Item 5 176 25 151 85.80%
    Item 2 264 5 259 98.11%
    Item 7 34 20 14 41.18%
    Item 3 937 40 897 95.73%
    Item 1 257 4 253 98.44%
    Item 6 847 231 616 72.73%
    Last edited by justinr; 12-16-2013 at 02:44 PM.

  5. #5
    Forum Expert
    Join Date
    12-11-2011
    Location
    Netherlands
    MS-Off Ver
    office 365
    Posts
    3,654

    Re: Help! Excel 2010 is not sorting correctly

    Please post the example as a xls file

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Help! Excel 2010 is not sorting correctly

    To attach a file to your post,
    click advanced (next to quick post),
    scroll down until you see "manage file",
    click that and select "add files" (top right corner).
    click "select files" find your file, click "open" click "upload" click 'done" bottom right. click "submit reply"

    Once the upload is completed the file name will appear below the input boxes in this window.
    You can then close the window to return to the new post screen.

  7. #7
    Registered User
    Join Date
    09-18-2013
    Location
    USA
    MS-Off Ver
    2010
    Posts
    29

    Re: Help! Excel 2010 is not sorting correctly

    Thank you, I got it attached to my latest post.

  8. #8
    Registered User
    Join Date
    09-18-2013
    Location
    USA
    MS-Off Ver
    2010
    Posts
    29

    Re: Help! Excel 2010 is not sorting correctly

    Here is a XLS version, although it said there would be formatting issues when i saved it.
    Excel Sorting issue sample1.xls

  9. #9
    Forum Expert
    Join Date
    12-11-2011
    Location
    Netherlands
    MS-Off Ver
    office 365
    Posts
    3,654

    Re: Help! Excel 2010 is not sorting correctly

    Take a look at this.
    Attached Files Attached Files

  10. #10
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Help! Excel 2010 is not sorting correctly

    excel doesnt like sorting formulas, seems it gets confused. I made a 2nd table... see if this will work for you?
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    09-18-2013
    Location
    USA
    MS-Off Ver
    2010
    Posts
    29

    Re: Help! Excel 2010 is not sorting correctly

    Thank you, this will work. Its weird that I cant sort correctly, I have never had an issue previously.
    I have other sheets on the main report that look just like this one and they are sortable. They don't use sumifs though, they just use countifs.
    Thanks for your help everyone!

  12. #12
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Help! Excel 2010 is not sorting correctly

    Happy to help

    Please use the thread tools near the top of the page to mark this thread closed

  13. #13
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Help! Excel 2010 is not sorting correctly

    I'll throw this in. I've incorporated a drop down list for Large and Small, choose one and the sort accordingly as well as have Conditional Formatting for the values.
    Attached Files Attached Files
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

+ 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. 0.0 number format by vba is not shown correctly in Excel 2010 chart
    By Mirkku in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-18-2013, 08:52 AM
  2. Excel 2010 Macro Not Referencing Numbers Correctly
    By datadigger in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-16-2012, 07:58 PM
  3. Excel 2010 Macro Not Referencing Numbers Correctly
    By datadigger in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-26-2012, 12:41 PM
  4. Excel not sorting numbers correctly
    By lpexcel in forum Excel General
    Replies: 2
    Last Post: 04-04-2012, 08:50 AM
  5. Macro works correctly on Excel 2010, but not on 2007...why?
    By matgray87 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-01-2011, 06:04 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