I used to know this a few years ago and for the life of me can't figure it out and can't find an answer in Google help.

I know how to sort columns, but only by the default A-Z format, how can I sort some columns by that and secondary ones by words that aren't alphabetical, like military rank? I know a couple of ugly workarounds, but I'd like the real deal.

• share a copy of your sheet Jun 5, 2019 at 19:04
• I need it sorted by alphabetically by column D first, then column E (which I know how to do), then by C, which is the rank of the soldier and this (sorting by text) is the only one I can't figure out docs.google.com/spreadsheets/d/…
– Mike
Jun 5, 2019 at 19:28
• I would be able to give the ranks a number i.e. a numerical rank, if needed
– Mike
Jun 5, 2019 at 19:34

There are two ways how to do it. Either use Create a filter or Create new filter view under Data after you select all columns:

The 3rd option would be to use a formula to sort the data based on a custom sequence which needs to be priorly defined

``````=ARRAYFORMULA(ARRAY_CONSTRAIN(QUERY({Sheet21!A2:N,
IFERROR(VLOOKUP(Sheet21!C2:C, {Z2:Z, ROW(Z2:Z)}, 2, 0))},
"order by Col4,Col5,Col15", 0), 9^232, 14))``````

• Thank you, I was trying to do it with assigning a number to their rank and using that to sort, I didn't know if there is a way to assign that rank/sequence
– Mike
Jun 5, 2019 at 20:05
• @Mike answer updated. also your sheet updated with sheet Sheet21 sorted that contains the formula and it sorts stuff as you wish based on custom order in Z column Jun 5, 2019 at 20:40