Excel How to Split Multiple Long Rows of Different Structures and Reorganize Them according to the Specified Format
Problem description & analysis
The following is data in CSV file:
A number of (N) records are stored in rows in the CSV file. Row 1 contains Country field values. Row 2 contains names of all the other fields. Row 3 contains values of all the other fields. Now we are trying to reorganize data in the file to make it standard rowwise data. The desired result is as follows:
Solution
Use SPL XLL plug-in of Excel
Write the formula in a blank cell:
=spl("=([[""country"",""goods"",""value""]]|transpose(?).run(if(~(1)==null,~(1)=~[-1](1)))).record().pivot(country;goods,value)",A1:M3)
As shown:
Explanation:
Transpose the data and add missing values to the Country column.
Add field names to generate a table sequence.
Use pivot() function to transpose rows to columns.
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/