SOLVED

Sort rows in smallest to largest but keep the blank rows in place

Copper Contributor

Hi,


Is it possible to sort a column from smallest to largest but keeping every other row which is a blank grey filled line in place? Currently when I sort it will sort the data but removed the gap spacer row each time

 

For example currently it is this:


column 1

55

(blank grey filled row)

2

(blank grey filled row)

37

(blank grey filled row)

 

But I would like it to sort like this:

 

Column 1

2

(blank grey filled row)

37

(blank grey filled row)

55

(blank grey filled row)


I don't have the best excel knowledge so please if anyone can help or let me know if this is possible.

 

Thank you!! :)  

 

5 Replies

@SJS191180 

Excel doesn't sort that way, but you could do the following:

Select column A.

Press F5 to activate the Go To dialog.

Click Special...

Select Blanks, then click OK.

Note the address of the active cell - probably A2.

Enter the formula =A1 (referring to the cell above the active cell) and confirm with Ctrl+Shift+Enter.

Select A1.

Sort in ascending order.

https://b23.tv/iyCUEJk
How about HTML output like above?

cli_add_css~tr:nth-child(even)
{
background:grey;
};
create temp table aa as
select * from sort_and_add_even_row_grey where F_A not like '' order by F_A;
select rowid old_rowid,* from aa union all
select rowid,'' from aa order by old_rowid;

@SJS191180 

A formula solution:

=LET(order,SCAN("",values,LAMBDA(a,v,IF(v="",a,v))),SORTBY(values,order))

 

Custom format the cells to pull the 0s returned from the array and you're set.

 

Patrick2788_0-1685734317960.png

 

best response confirmed by SJS191180 (Copper Contributor)
Solution

@SJS191180 

An alternative could be Power Query. In the attached file you can add data to the blue dynamic table. Then you can click in any cell of the green table and right-click with the mouse and select refresh to update the green result table.

sort.JPG

Thank you for your help!!
1 best response

Accepted Solutions
best response confirmed by SJS191180 (Copper Contributor)
Solution

@SJS191180 

An alternative could be Power Query. In the attached file you can add data to the blue dynamic table. Then you can click in any cell of the green table and right-click with the mouse and select refresh to update the green result table.

sort.JPG

View solution in original post