4

When I sort a column in Google Spreadsheets, the blanks always seem to sink to the bottom. Can I have rows with blank cels be organized first / highest?

Alternatively, is there a function wherein I can specify a sort order based on an array of options, like

[
  [1,''],
  [2,'i'],
  [3,'x']
]

where 1,2,3 is the sort order DESC. the string is the char to match and associate with that sort order.

1
  • There is no reasonable possibility, if you do not put something "invisible" into the cells, which is certainly a nuissance. Yes, this contradicts what most users expect from sorting. Commented Apr 5 at 9:11

3 Answers 3

4

I do not think you have any way to control the sort order directly, other than ascending or descending, so suggest a lookup table and a helper column (to determine the sort order) with a formula in that such as:

 =if(B1="",1,vlookup(left(B1,1),E:F,2,0))  

where ColumnB is the one to be sorted, ColumnE the sort order and ColumnF a number starting at 1 and incrementing by one for each row.

5

One easy way to make the blank cells appear at the top of the sheet when sorted is to enter an apostrophe ' in the empty cells.

The apostrophe ' will not be displayed in the cell, so it will continue to appear to be a blank cell however when you sort in ascending or descending order, it will put the pseudo-blank cell either at the top or at the bottom of the sheet.

3

An alternative regarding blanks sinking to the bottom is to use QUERY, where they float to the top. So starting with:

WA67363 example

this formula in D1:

=query(A1:A3,"Select * order by A")  

will return a blank in D1, i in D2 and x in D3.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.