DEV Community

Cover image for #126 — Group When Encountering Non-Null Values
2 1 1 1 1

#126 — Group When Encountering Non-Null Values

Problem description & analysis:

We have an annual and monthly water-consumption data table, and the year is filled in only on the left of the first month of each year. Part of the data is shown as below:

source table

Task: Calculate the total water consumption of each year.

Solution:

Use SPL XLL and enter the formula in cell D1:

=spl("=E(?1).derive(:TotalWater).group@i(Year!=null).run(~(1).TotalWater=~.sum(Water)).conj().new(TotalWater)",A1:C20)
Enter fullscreen mode Exit fullscreen mode

The results are as follows:

result table

When meeting a non-null value in the column Year, create a new group. Option @i means creating a new group when the condition is satisfied. Assign the sum(Water) of the current group to the first row of each group, and create a new data set and take out the TotalWater.


Download esProc Desktop for FREE and kick off 2025 with productivity 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

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more

Top comments (1)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.

nextjs tutorial video

Youtube Tutorial Series 📺

So you built a Next.js app, but you need a clear view of the entire operation flow to be able to identify performance bottlenecks before you launch. But how do you get started? Get the essentials on tracing for Next.js from @nikolovlazar in this video series 👀

Watch the Youtube series