#48 — In An Excel Table, Find Rows Corresponding to The 1st And The Last Non-Empty Cells in Each Column
Judith-Excel-Sharing
Posted on August 21, 2024
Problem description & analysis:
In the Excel table below, columns from the 2nd to the 6th have empty cells.
Task: From each column from the 2nd to the 6th, find the first and the last non-empty cells and concatenate the cell values they correspond in the 1st column using "to".
Solution:
Use SPL XLL to do this:
=spl("=d=E@2p(?),d.to(2,).(d(1)(~.pselect@z(~)) /""to""/ d(1)(~.pselect(~)))",A2:F15)
As shown in the picture below:
E@2p converts a two-layer sequence to a table sequence. pselect()function gets the position of the first member that meets the specified condition; u/z enables a search backward. to(2,) gets members from the 2nd to the last; (1) represent the 1stmember.
💖 💪 🙅 🚩
Judith-Excel-Sharing
Posted on August 21, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
tutorial #44 — Group Rows And Combine Non-Null Values in Each of The Non-Grouping Columns
August 13, 2024