DEV Community

Cover image for #77 - Conditional Aggregation
Judith-Excel-Sharing
Judith-Excel-Sharing

Posted on

#77 - Conditional Aggregation

Problem description & analysis:

Here below is a data table:

source table

Task: Count the following information for each class: the number of students with scores above 90, the number of failed students, and the average score after removing the highest and lowest scores.

Solution:

Use SPL XLL and the code is as follows:

=spl("=E(?1).group(Class).new(Class,~.count(Score>=90):'ScoreAbove90',~.count(Score<60):Failed,~.sort(Score).m(2:-2).avg(Score):AverageScore)", A1:C19)
Enter fullscreen mode Exit fullscreen mode

where m(2:-2) represents the set of members from the second to penultimate member of a sequence.

The results are shown below:

result table


Download esProc Desktop for FREE and let the SPL XLL formula do all the heavy lifting for you! !! 🚀🔥⬇️

✨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 (1)

Collapse
 
judith677 profile image
Judith-Excel-Sharing

Curious to learn more? Drop your thoughts or questions in the communities or the comments directly!👇

Discord
Reddit