#121 — Enumeration Grouping

#121 — Enumeration Grouping

Problem description & analysis:

Here below is a data table:

Task: We want to put Apple, Banana, and Orange in a group and name them Fruits, put Pork, Beef, and Mutton in a group and name them Meats, and put the rest of the goods in a group and name them Others. And then count the total sales of each group.

Solution:

Use SPL XLL and enter the following code:

=spl("=E(?1).groups(if([""Apple"",""Banana"",""Orange""].pos(Goods)!=null:""Fruits"", [""Pork"",""Beef"",""Mutton""].pos(Goods)!=null:""Meats""; ""Others""):Goods; sum(Sales):Sales)", A1:B14)

The results are as follows:


Download esProc Desktop for FREE and keep your workflow intuitive and efficient 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