I'm looking for a way to sort an area in Google Sheets using script When sorting, 2 rows should always be grouped and then sorted by column B. Can someone help me please?
I have this
COLUMN A COLUMN B
Porsche | 11
green | 11
Mercedes | 8
green | 8
Ford | 10
red | 10
I want this:
Mercedes | 8
green | 8
Ford | 10
red | 10
Porsche | 11
green | 11
You could try this formula:
=ARRAYFORMULA(QUERY(
SORT(
{A2:A, B2:B, IF(MOD(ROW(A2:A)-ROW(A2)+1, 2) = 0, B2:B, OFFSET(B2:B, 1, 0))},
3, TRUE
),"Select Col1,Col2")
)