I have this local JavaScript function to sort the way I'm describing:
const lines = ['foo', 'bing', 'world', 'baz', 'hello', 'bar', 'blank']
.sort((a, b) => {
const len = a.length - b.length
if (len) return len
return a.localeCompare(b)
})
It will return:
['bar', 'baz', 'foo', 'bing', 'blank, 'hello', 'world']
How do I forcefully sort the Google Sheet by a specific column (say column C), by length then alphabetically like this? Not a function which I plug into a cell, but like selecting the Sort A->Z option, how can I reorganize the sheet like this?
I have seen this, which says:
=INDEX(SORT(A2:A; LEN(A2:A); 1))
But that will simply render the input in another column, which is not what I want. I want the whole spreadsheet to sort (every row) based on the specific column sort order as described.