Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sorting by alternate numbered rows without losing data

I want to sort by Sr.No. in ascending order in such a way that I get both Name and ID in the same order.Since the ID has no numbering alongside I am facing difficulty in doing so, can anyone please help .

I want to sort by Sr.No. in ascending order in such a way that I get both Name and ID in the same order.Since the ID has no numbering alongside I am facing difficulty in doing so, can anyone please help

like image 826
starkfrau Avatar asked Sep 11 '25 03:09

starkfrau


1 Answers

P.b's answer is so elegant I can't compete.

But just for the record I took the question as requiring each person's data to be kept on two rows so came up with this:

=LET(range,A2:B9,
ser,INDEX(range,,1),
fill,SCAN(0,ser,LAMBDA(a,c,IF(c="",a,c))),
sort,SORTBY(range,fill),
IF(sort="","",sort))

enter image description here

like image 181
Tom Sharpe Avatar answered Sep 13 '25 05:09

Tom Sharpe