DEV Community

Cover image for #73 — Use Grouped Aggregation Values When Filtering
Judith-Excel-Sharing
Judith-Excel-Sharing

Posted on

#73 — Use Grouped Aggregation Values When Filtering

Problem description & analysis:

We have an aggregation table for the sales of grouped products:

source table

Task: Now we want to find out the product whose sales is greater than the average in its group.

Solution:

Use SPL XLL and enter the following formula:

=spl("=E(?1).group(CategoryName).(a=~.avg(ProductSales),~.select(ProductSales>a)).conj()",A1:C78)
Enter fullscreen mode Exit fullscreen mode

To solve this problem, we can first calculate group’s average sales and assign it to the temporary variable a, and then use ProductSales>a as the filter condition to filter the group.

The results are as shown below:

result table


Download esProc Desktop for FREE and see how it can enhance your workflow!!! 🚀🔥⬇️

✨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

Top comments (0)