Function Problems

Convert an Excel Range to a Dynamic Column or Row

Huma Ashraf ChHuma Ashraf Ch Dec 2, 2026 869 views

Question details

Convert a two-dimensional range into a single dynamic column or row, optionally excluding blanks and duplicates.

Convert an Excel Range to a Dynamic Column or Row
Product
Microsoft Excel
Device & OS
not provided
Scenario
The user wants to reshape the values in a range into a one-dimensional array that updates when source values change.
Observed behavior
The desired result is a spilled column or row containing the range values, with optional blank filtering and duplicate removal.
Before you start

Check that your Excel version supports TOCOL and TOROW, and identify the source range you want to reshape. Leave enough empty cells below or to the right of the formula for the result to spill.

Solution 1Recommended

Use TOCOL or TOROW to reshape the range

Create a dynamic column or row and optionally skip blanks and remove duplicates.

1
Choose an output cell

Select an empty cell outside the source range B2:Q350, with room below it for a column or to its right for a row.

2
Create a column or row

Enter =TOCOL(B2:Q350,1) for a column or =TOROW(B2:Q350,1) for a row, then press Enter. The argument 1 skips blank cells.

3
Remove duplicates if needed

For a column of unique values, enter =UNIQUE(TOCOL(B2:Q350,1)). For a row of unique values, enter =UNIQUE(TOROW(B2:Q350,1),TRUE); TRUE tells UNIQUE to compare columns.

Use TOCOL or TOROW to reshape the range
Formula availability: TOCOL and TOROW require a supported Excel version. The formulas update when values in B2:Q350 change, but the range reference must be expanded if new source cells are added outside it.
Work with dynamic arrays

Reshape spreadsheet ranges in WPS Office

In a WPS Spreadsheet version that supports TOCOL, TOROW, and UNIQUE, use the same dynamic array formulas to turn a range into a column or row.

  1. 1. Open the workbook: Open WPS Spreadsheet and use File > Open to select your Excel workbook.
  2. 2. Select an output cell: Click an empty cell outside the source range, leaving space for the result to spill.
  3. 3. Enter a formula: If your WPS version supports the function, enter =TOCOL(B2:Q350,1) for a column or =TOROW(B2:Q350,1) for a row, then press Enter.
  4. 4. Remove duplicates if needed: Use =UNIQUE(TOCOL(B2:Q350,1)) for a unique column or =UNIQUE(TOROW(B2:Q350,1),TRUE) for a unique row. If the functions are unavailable, use a supported Excel version for these formulas.
Reshape a range and optionally skip blanks or remove duplicatesOpen and edit Microsoft Excel XLSX filesWork in a familiar spreadsheet interfaceUse WPS Office for free
QA img-9

Frequently Asked Questions

How do I keep blank cells in the result?

Omit the ignore argument or set it to 0, for example =TOCOL(B2:Q350,0).

Why does Excel show a #SPILL! error?

The output area may be blocked. Clear cells below the TOCOL formula or to the right of the TOROW formula, then check the result again.

Why does UNIQUE need TRUE for a row?

UNIQUE compares rows by default. In =UNIQUE(TOROW(B2:Q350,1),TRUE), TRUE makes it compare the columns in the spilled row.

Will the formula include rows added below B2:Q350?

Not automatically. Update the range reference in the formula or use a suitable expanding table reference.