How to Transpose Multiple Color Values Across Rows in Excel
Question details
The user wants to group vertically stored data attributes (like color options) by a category (style number) and output them horizontally across rows.

- Product
- Excel 365
- Device & OS
- not provided
- Scenario
- Reformatting a dataset where multiple attributes for a single item are listed in separate rows, converting them into a dynamic table with one row per item and attributes spread across columns.
- Observed behavior
- The data needs to be dynamically grouped and spilled horizontally using modern array formulas without manual copying or pivoting.
Ensure you are using a version of Excel that supports dynamic array functions (like Excel 365 or Excel 2021) and that your data columns are defined as named ranges or structured table references.
Use REDUCE and VSTACK Dynamic Array Functions
Utilize modern array functions to dynamically iterate through your data, group it by category, and stack the transposed results into a single spilling output.
This method leverages advanced functions like LET, REDUCE, VSTACK, and LAMBDA. It creates a loop that iterates over unique style numbers, extracts the corresponding colors using FILTER and TOROW, and stacks them into a new dynamic table.
Define the named ranges for your source data. In this example, the category column is named 'StyleNumber' and the attribute column is named 'ColourInfo'.
Click on the top-left empty cell where you want the new dynamic table to begin spilling.
Enter the following formula: =LET(styles,SORT(UNIQUE(StyleNumber)), pivot,LAMBDA(acc,v, LET(record,TOROW(FILTER(ColourInfo,StyleNumber=v),,1), IFERROR(VSTACK(acc,HSTACK(v,record)),""))), DROP(REDUCE("",styles,pivot),1))
Press Enter. The formula will calculate and automatically spill the transposed color values across the adjacent rows and columns, grouped by each unique style number.

Easily Transpose and Group Data in WPS Office
WPS Spreadsheet supports advanced dynamic array functions and provides powerful data processing tools to help you transpose, group, and analyze complex datasets seamlessly.
- 1. Open Your Dataset: Launch WPS Spreadsheet and open your existing dataset containing the vertical records.
- 2. Select Target Range: Click on the destination cell where you want your transposed data to appear.
- 3. Apply Functions or PivotTools: Use built-in dynamic array functions like UNIQUE and FILTER in the formula bar, or utilize the PivotTable feature from the 'Insert' tab to restructure your rows and columns visually.
- 4. Save as XLSX: Save your completed file seamlessly in the standard .xlsx format to retain full functionality and formatting.

Frequently Asked Questions
Can I group and transpose data without Excel 365 dynamic arrays?
Yes, in older versions of Excel, you can use Power Query to group your data by the style number and pivot the color column. Alternatively, you can use traditional INDEX and MATCH formulas combined with helper columns.
Why is my dynamic array formula returning a #SPILL! error?
A #SPILL! error occurs when the dynamic array formula does not have enough empty adjacent cells to display all the calculated results. Clear any blocking data in the spill range to resolve the error.
How does the TOROW function help in this scenario?
The TOROW function transforms an array or a specific range into a single row. In this formula, it takes the vertically filtered list of colors for a specific style and lays them out horizontally so they can be stacked.




