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.
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.
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
I don't know even where to start with the coding I can attach a sample of what I need sorted though.
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.
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.
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 iconbelow the post.
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.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks