+ Reply to Thread
Results 1 to 7 of 7

Button to sort by color then by value

  1. #1
    Registered User
    Join Date
    02-24-2021
    Location
    United States
    MS-Off Ver
    excel 2013
    Posts
    18

    Question Button to sort by color then by value

    I need to make a button that can sort my data by color then by value. I am getting tired of setting up the sorter. I have four colors I need to sort.
    Last edited by Lelaurin52; 05-27-2021 at 06:30 AM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2509 Win 11
    Posts
    24,992

    Re: Button to sort by color then by value

    Fast answers need visual help. Please read the yellow banner at the top of this page on how to attach a file.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    02-24-2021
    Location
    United States
    MS-Off Ver
    excel 2013
    Posts
    18

    Re: Button to sort by color then by value

    I don't know even where to start with the coding I can attach a sample of what I need sorted though.
    Attached Files Attached Files

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2509 Win 11
    Posts
    24,992

    Re: Button to sort by color then by value

    1. You can sort by color so long as the coloring is not conditional. In your example, all the colors were created conditionally. Is this how your real life data is sourced or has the coloring been assigned in some other manner.

    2. Here is a simple code to determine the color index for data that is not conditionally colored. It will place the color index in Column B. You can then use the native sort feature to sort on color and then by location.

    3. Be aware that this will not work with your conditionally formatted data

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    02-24-2021
    Location
    United States
    MS-Off Ver
    excel 2013
    Posts
    18

    Re: Button to sort by color then by value

    Yeah so it dose have conditional formatting for the colors depending on the A,B,C, OR D level of the location. The data is pulled externally and the format is changed depending on the level that is returned. When I use this on my doc it changes the values as well.
    Last edited by Lelaurin52; 05-13-2021 at 06:59 AM.

  6. #6
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Button to sort by color then by value

    Personally I think sorting by colour is open to mistake, particularly where someone can make a subtle change to a colour shade.

    I'd use a helper column with B" copied down

    =MID(A2,7,2)

    Then just sort by column B as the first level and col A as the second.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  7. #7
    Forum Expert ByteMarks's Avatar
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    3,274

    Re: Button to sort by color then by value

    If you can use another column, then you take the conditional formatting formulae and have them evaluate to something you can sort by. You can then reapply the conditional formats based on that value.

+ 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. Auto Sort Overrides Color Sort
    By AngXen in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-17-2018, 04:01 PM
  2. Formula to sort columns instead of using the sort button
    By Hyflex in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-17-2016, 10:20 PM
  3. Sort Button that does not sort Balance Columns
    By hasancem in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-28-2012, 10:31 AM
  4. [SOLVED] Change Background color of a Form Button or ActiveX Button
    By Aeneren in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 04-11-2012, 12:19 PM
  5. sort button - how to sort large range in boxes
    By jw01 in forum Excel General
    Replies: 2
    Last Post: 03-06-2012, 09:35 PM
  6. Sort or sub-total by Fill color or font color
    By Excel_seek_help in forum Excel General
    Replies: 1
    Last Post: 04-27-2006, 04:10 PM
  7. Excel sort by Fill Color by custom list sort
    By Dash4Cash in forum Excel General
    Replies: 2
    Last Post: 07-29-2005, 06:05 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