#42 — Skip Empty Cells To Sort Members

esProc DesktopesProc Desktop
2 min read

Problem description & analysis:

In the Excel table below, column A and column B form the content structure. The dates in column A are not arranged in chronological order.

AB
1DateBook Title
201.01.2022
3Title1
4Title2
503.01.2022
602.01.2022
7Title3
802.01.2022
9Title4

Task: Sort dates in column A in correct chronological order while keeping the empty cells in their original positions. Column B will remain what it is.

DE
1DateBook Title
201.01.2022
3Title1
4Title2
502.01.2022
602.01.2022
7Title3
803.01.2022
9Title4

Solution:

Use SPL XLL to do this task:

=spl("=d=E@1(?), d(p=d.pselect@a(~))=d(p).sort(),d",A2:A9)

As shown in the picture below:

r/esProc_Desktop - Skip Empty Cells To Sort Members

Explanation:

E@1 converts a data range to a single-layer sequence. pselect@a gets positions of all members meeting the specified condition; ~ is the current member. "sequence 1(a set of positions)= sequence 2" modifies members of sequence 1 at specified positions into sequence 2.

Please feel free to download esProc Desktop and learn more about how to efficiently manage and clean your Excel data⬇️

SPL download address: esProc Desktop Download

Plugin Installation Method: SPL XLL Installation and Configuration

References to other rich Excel operation cases: Desktop and Excel Data Processing Cases

SPL Programming (YouTube FREE courses): https://www.youtube.com/playlist?list=PLQeR-IhHo7qNCw6o7PW8YfHvRx8pgzZso

0
Subscribe to my newsletter

Read articles from esProc Desktop directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

esProc Desktop
esProc Desktop

esProc Desktop is a desktop data processing & analytics tool and is specifically designed for ordinary business people. It supports complex computations & spreadsheet data manipulation, can deal with tasks that are hard to accomplish in Excel, and in addition, generates more concise code than VBA and Python. esProc Desktop boasts all-around programming capabilities, supports multi-step interactive data analytics and is easy to use without configurations. This significantly lowers the technical threshold for data analytics.