DEV Community

Cover image for #134 — Convert Row-Based Table to Crosstab
Judith-Excel-Sharing
Judith-Excel-Sharing

Posted on

#134 — Convert Row-Based Table to Crosstab

Problem description & analysis:

The following data table records the daily sales of products:

source table

Task: Now we want to create a crosstab, with the SaleDate as the left header of crosstab, and the Products as the upper headers of crosstab, like this:

result table

Solution:

Use SPL XLL and enter the following code:

=spl("=E(?1).pivot(SaleDate;Product,Amount)",Sheet1!A1:C16)
Enter fullscreen mode Exit fullscreen mode

Code explanation: Perform the row-to-column conversion based on SaleDate column, the values in the Product column are transferred and used as the new column names, and the values in the Amount column are transferred and used as the values in new columns.


Download esProc Desktop for FREE and fast & dynamic Excel transformations!! 🚀✨⬇️

✨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

Top comments (1)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.