#124 — Take Adjacent Data as Grouping Criteria

Judith-Data-Processing-Hacks - Dec 31 '24 - - Dev Community

Problem description & analysis:

Here below is a data table:

source table

Task: Group the data in the first column, and calculate the sum of the values in the second column of each group. Grouping criteria: when there is a difference of 5 or more between the current data and previous one, create a new group.

Solution:

Use SPL XLL and enter the following formula:

=spl("=E@b(?1).group@i(#1-#1[-1]>=5).new(#1:ID,~.sum(#2):Total)",A1:B12)
Enter fullscreen mode Exit fullscreen mode

The results are as follows:

result table


Download esProc Desktop for FREE and have a brighter 2025 using SPL XLL!! 🚀✨⬇️

✨SPL download address: esProc Desktop FREE Download

✨Plugin Installation Method: SPL XLL Installation and Configuration

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

✨YouTube FREE courses: SPL Programming

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .