#51 - Get Rankings of Excel Rows in Each Group While Retaining the Existing Order
Judith-Excel-Sharing
Posted on August 26, 2024
Problem description & analysis:
We have an unordered Excel table, where the 1st column is the grouping column and the 2nd column contains dates.
Task: Get rankings of rows in each group and write them in the 3rd column while retaining the existing order of the rows. The expected result is as follows:
Solution:
Use SPL XLL to do this:
=spl("=E(?).derive(#:id,rk).sort(#1,#2).run(rk=rank(#2;#1)).sort(id).(rk)",A1:B14)
As shown in the picture below:
E()function converts the Excel data range to a table. derive() function adds a new column. rank() function gets rankings of records in each sorted group. # is the row number and #1 represents the 1st column.
💖 💪 🙅 🚩
Judith-Excel-Sharing
Posted on August 26, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
productivity #51 - Get Rankings of Excel Rows in Each Group While Retaining the Existing Order
August 26, 2024
productivity #29 — Group an Excel table and Store It as Multiple Files According to Part of The Values of Specified Cells
July 19, 2024