Excel Column-to-Row Transposition
Problem description & analysis
We have an Excel data:
A  |  
   B  |  
   C  |  
   D  |  
  |
1  |  
   Name  |  
   Fruit1  |  
   Fruit2  |  
   Fruit3  |  
  
2  |  
   Alice  |  
   apple  |  
   banana  |  
   orange  |  
  
3  |  
   Bob  |  
   apple  |  
   pear  |  
   plum  |  
  
4  |  
   Cate  |  
   banana  |  
   pear  |  
   plum  |  
  
…  |  
   
We are trying to transpose columns to rows. Below is the expected result:
A  |  
   B  |  
   C  |  
   D  |  
  |
1  |  
   Fruit  |  
   Name1  |  
   Name2  |  
   ……  |  
  
2  |  
   apple  |  
   Alice  |  
   Bob  |  
   |
3  |  
   banana  |  
   Alice  |  
   Cate  |  
   |
4  |  
   orange  |  
   Alice  |  
   ||
5  |  
   pear  |  
   Bob  |  
   Cate  |  
   |
6  |  
   plum  |  
   Bob  |  
   Cate  |  
   
Solution
Use the SPL XLL plug-in
Write the following code in a blank cell
=spl("=E(?1).pivot@r(Name;Fruit,Fruitname).group(Fruitname).run(~=~.Fruitname|~.(Name))",Sheet1!A1:D4)
As shown:

Return:

Explanation:
Use pivot to perform column-to-row transposition, then group the table by Fruitname, get the Fruitname value for each group and concatenate it with the Name value.
Q & A Collection
SPL Official Website 👉 https://www.esproc.com
SPL Feedback and Help 👉 https://www.reddit.com/r/esProc_Desktop/
SPL Learning Material 👉 https://c.esproc.com
Discord 👉 https://discord.gg/sxd59A8F2W
Youtube 👉 https://www.youtube.com/@esProcDesktop
Linkedin Group 👉 https://www.linkedin.com/groups/14419406/