13.7 Re-group or sort when filling grouped data into columns
There is a data table. In this table, the products with the same name may have multiple colors.
The task is to convert the data to the form as shown below, that is, arrange each type of product in one row, and then list the Name and Color of each product in turn.
Script:
=spl("=E(?1).group(Type).(~.group(Name)).((~.Type|~.(Name|~.(Color))).conj@r())",Sheet1!A1:C8)
First group by Type, and then group by Name in each group.
Loop through groups of Type. First take Type, and then add the sequence composed of Name and Color of each group in its Name subgroups, and finally use conj to concatenate the sequence. Option @r means recursive calculating until all members are no longer a sequence.
esProc Desktop and Excel Processing
13.6 Put data in a group horizontally into columns
13.8 Convert certain columns of the same row, as group members, to multiple rows
SPL Official Website 👉 https://www.scudata.com
SPL Feedback and Help 👉 https://www.reddit.com/r/esProc_Desktop/
SPL Learning Material 👉 https://c.scudata.com
Discord 👉 https://discord.gg/cFTcUNs7
Youtube 👉 https://www.youtube.com/@esProcDesktop
Linkedin Group 👉 https://www.linkedin.com/groups/14419406/