#137 — Re-group or Sort When Filling Grouped Data into Columns

Problem description & analysis:

There is a data table. In this table, the products with the same name may have multiple colors.

Task: Convert the data to the form as shown below, that is, arrange each type of product in one row, and t…


This content originally appeared on DEV Community and was authored by Judith-Excel-Sharing

Problem description & analysis:

There is a data table. In this table, the products with the same name may have multiple colors.

source table

Task: 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. The results are shown below:

expected results

Solution:

Use SPL XLL and enter the following code:

=spl("=E(?1).group(Type).(~.group(Name)).((~.Type|~.(Name|~.(Color))).conj@r())",Sheet1!A1:C8)

Code explanation:

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.

Download esProc Desktop for FREE and level up your Excel skills now!! 🚀✨⬇️

✨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


This content originally appeared on DEV Community and was authored by Judith-Excel-Sharing


Print Share Comment Cite Upload Translate Updates
APA

Judith-Excel-Sharing | Sciencx (2025-01-26T04:14:42+00:00) #137 — Re-group or Sort When Filling Grouped Data into Columns. Retrieved from https://www.scien.cx/2025/01/26/137-re-group-or-sort-when-filling-grouped-data-into-columns/

MLA
" » #137 — Re-group or Sort When Filling Grouped Data into Columns." Judith-Excel-Sharing | Sciencx - Sunday January 26, 2025, https://www.scien.cx/2025/01/26/137-re-group-or-sort-when-filling-grouped-data-into-columns/
HARVARD
Judith-Excel-Sharing | Sciencx Sunday January 26, 2025 » #137 — Re-group or Sort When Filling Grouped Data into Columns., viewed ,<https://www.scien.cx/2025/01/26/137-re-group-or-sort-when-filling-grouped-data-into-columns/>
VANCOUVER
Judith-Excel-Sharing | Sciencx - » #137 — Re-group or Sort When Filling Grouped Data into Columns. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/01/26/137-re-group-or-sort-when-filling-grouped-data-into-columns/
CHICAGO
" » #137 — Re-group or Sort When Filling Grouped Data into Columns." Judith-Excel-Sharing | Sciencx - Accessed . https://www.scien.cx/2025/01/26/137-re-group-or-sort-when-filling-grouped-data-into-columns/
IEEE
" » #137 — Re-group or Sort When Filling Grouped Data into Columns." Judith-Excel-Sharing | Sciencx [Online]. Available: https://www.scien.cx/2025/01/26/137-re-group-or-sort-when-filling-grouped-data-into-columns/. [Accessed: ]
rf:citation
» #137 — Re-group or Sort When Filling Grouped Data into Columns | Judith-Excel-Sharing | Sciencx | https://www.scien.cx/2025/01/26/137-re-group-or-sort-when-filling-grouped-data-into-columns/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.