I'm banging my head against the wall trying to figure this one out, can anyone help?
My spreadsheet has many columns, one of which is sort of an ID Code or flag column (column B). For one of the views of this data, I need to treat rows differently based on the value of the ID Code in column B.
So, for example, say the ID codes are X, Y, Z, or no id (null). I need to be able to pull all of the rows with ID code X to the top of the list; the remaining codes can go back in amongst those with no code for sorting. After I do that and get the X's at the top of the list, I need to be able to apply my primary sort first to the list of X's and then to the remaining list. The goal is to have all of the X's at the top with the chosen sort applied, and everything remaining below with the same chosen sort applied.
I will need to set this up to sort on a number of different criteria, so I am hoping to set this up programmatically rather than having to do it manually each time. I've got some idea of the logic but need help with the code.
- So first, I'm sorting by column B to get my X's to the top.
- Next I'm finding the last row with an X in column B, and applying the sort to that range.
- Then I'm finding the last row with an X in column B plus one, and applying the sort from there to the end of the range (last row with any data at all)
Does that seem right? Is this ridiculously crazy or impossible to do?
Bookmarks