Date:

Convert Row-Based Table to Crosstab

Problem Description & Analysis

The following data table records the daily sales of products.

[Image: 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:

[Image: result table]

Solution

Use SPL XLL and enter the following code:

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

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.

Conclusion

By using SPL XLL, you can easily create a crosstab with the desired structure and perform advanced data processing and analysis in Excel.

Frequently Asked Questions

Q: What is SPL XLL?
A: SPL XLL is a powerful Excel add-in that allows you to perform advanced data processing and analysis in Excel.

Q: How do I install SPL XLL?
A: You can download SPL XLL from the official website and follow the installation instructions.

Q: What are some other rich Excel operation cases?
A: You can find more examples and tutorials on the official website.

Q: Where can I find free courses on SPL programming?
A: You can find free courses on SPL programming on the official YouTube channel.

Latest stories

Read More

LEAVE A REPLY

Please enter your comment!
Please enter your name here