Excel Formula to Transpose Columns to Rows and Exclude Blank Cells

📅 May 01, 2026 📝 Sarah Miller

Manually restructuring sprawling datasets while filtering out empty spaces is a notoriously tedious task for analysts. Just as organizations evaluate standard funding sources to bridge operational gaps, Excel users typically rely on basic transposing methods first. However, leveraging a modern dynamic array formula grants you automated, real-time data consolidation. Under the stipulation that you are utilizing Excel 365, combining the TOCOL and FILTER functions serves as the ultimate solution for removing blanks. Below, we will break down this formula step-by-step to optimize your data workflow.

Excel Formula to Transpose Columns to Rows and Exclude Blank Cells

In data analysis, we often encounter datasets that are structured vertically (in columns) but need to be displayed horizontally (in rows) for reporting, dashboarding, or specific calculation models. While Excel's traditional Paste Transpose feature is handy, it is static and copies over everything-including empty cells.

When working with dynamic datasets, you need a formula-based solution that automatically updates when your source data changes and ignores empty spaces. In this comprehensive guide, we will explore several methods to transpose columns to rows while skipping blank cells, ranging from modern dynamic array formulas to backward-compatible legacy solutions.

Why Avoid Blank Cells When Transposing?

Leaving blank cells in a transposed row can disrupt data visualization, cause gaps in charts, and break consecutive calculations. Filtering out blanks during the transposition process ensures that your final row is clean, compact, and ready for analysis without requiring manual clean-up.


Method 1: The Modern & Easiest Way – Using the TOROW Function (Excel 365 & 2021+)

If you are using Microsoft 365 or Excel for the Web, Excel has introduced built-in functions designed specifically for reshaping arrays. The most efficient tool for this job is the TOROW function.

The TOROW function transforms an array or range into a single horizontal row, and it includes a built-in parameter to handle empty cells seamlessly.

The Formula Syntax

=TOROW(array, [ignore], [scan_by_column])
  • array: The range of columns you want to transpose.
  • ignore: A setting that tells Excel what to skip. Passing 1 tells the formula to ignore blanks.
  • scan_by_column: A boolean value. If processing a 2D range, TRUE reads column by column, while FALSE (or omitted) reads row by row.

Step-by-Step Example

Imagine you have the following list of project milestones in column A (A2:A10), with some uncompleted steps left blank:

Row Column A (Milestones)
2Kickoff Meeting
3[Blank]
4Design Approval
5[Blank]
6Prototype Built
7Beta Testing
8[Blank]
9Launch

To transpose this column into a clean, horizontal row starting at cell C2, enter the following formula:

=TOROW(A2:A9, 1)

The Result: Excel instantly outputs a horizontal array spanning from C2 to G2 containing only the populated milestones, automatically skipping the empty rows:

Cell C2 Cell D2 Cell E2 Cell F2 Cell G2
Kickoff Meeting Design Approval Prototype Built Beta Testing Launch

Method 2: Combining TRANSPOSE and FILTER

Another robust dynamic array solution is combining the classic TRANSPOSE function with the FILTER function. This approach is highly flexible because it allows you to filter out blank cells plus apply other custom criteria at the same time.

The Formula

=TRANSPOSE(FILTER(A2:A9, A2:A9 <> ""))

How It Works

  1. FILTER(A2:A9, A2:A9 <> ""): This inner function looks at the range A2:A9 and extracts only the cells that are not equal to empty strings (""). This strips away all the blanks, leaving a smaller, vertical array of populated values.
  2. TRANSPOSE(...): The outer function takes that filtered vertical list and rotates its orientation 90 degrees into a horizontal row.

This method is particularly useful if your "blank" cells actually contain hidden space characters or specific placeholder texts (e.g., "N/A"), as you can adjust the logical criteria inside the FILTER function to skip those as well.


Method 3: The Legacy Approach (Excel 2019 and Older)

If you are working on an older version of Excel that does not support dynamic arrays (like TOROW or FILTER), you must use a traditional array formula. This approach relies on a combination of INDEX, SMALL, IF, and COLUMN (or ROW) functions.

Because legacy Excel cannot dynamically "spill" results across cells, you will need to enter this formula in the first destination cell and drag it horizontally across the row.

The Array Formula

Enter the following formula in cell C2, and press Ctrl + Shift + Enter (not just Enter) to register it as an array formula:

=IFERROR(INDEX($A$2:$A$9, SMALL(IF($A$2:$A$9<>"", ROW($A$2:$A$9)-ROW($A$2)+1), COLUMN(A1))), "")

Once entered, drag the fill handle to the right across as many columns as needed to capture your data.

How It Works

  • IF($A$2:$A$9<>"", ROW($A$2:$A$9)-ROW($A$2)+1): This creates an array of relative row positions for all non-blank cells. For blank cells, it returns FALSE.
  • SMALL(..., COLUMN(A1)): As you drag the formula to the right, COLUMN(A1) increments (A1 becomes B1, then C1, yielding numbers 1, 2, 3, etc.). The SMALL function uses this incrementing number to return the 1st, 2nd, and 3rd smallest relative row numbers that are not blank.
  • INDEX($A$2:$A$9, ...): This retrieves the actual values from our source range based on those non-blank row positions.
  • IFERROR(..., ""): Once all valid entries are extracted, further dragged formulas will throw an error. IFERROR catches these and keeps those cells looking clean and blank.

Handling "Formula Blanks" (Empty Strings)

A common pitfall occurs when cells are not truly empty but contain formulas that return an empty string ("").

  • The TOROW(array, 1) function treats formula-driven empty strings ("") as valid text strings rather than true blank cells. Consequently, they may still appear in your transposed row.
  • To solve this issue, always use the Method 2 (TRANSPOSE + FILTER) formula, because the logical test A2:A9 <> "" explicitly target and excludes formula-generated empty strings.

Summary: Choosing the Right Tool

To help you decide which approach to use for your specific spreadsheet, refer to the comparison table below:

Method Excel Compatibility Complexity Handles Formula Blanks ("")?
TOROW Office 365, Web Very Low (Easiest) No (Treats them as text)
TRANSPOSE + FILTER Office 365, Excel 2021 Low Yes (Highly Recommended)
Legacy Array (INDEX/SMALL) All Versions (Excel 2010+) High (Requires Ctrl+Shift+Enter) Yes

Conclusion

Reshaping your data shouldn't require tedious manual copying and pasting. If you are on a modern version of Excel, using TOROW or TRANSPOSE(FILTER()) provides a dynamic, hands-off system that updates automatically when new rows are added or empty cells are updated. For older environments, the robust INDEX/SMALL array method guarantees that your sheets remain functional and clean across all legacy platforms.

Disclaimer:
The documents and templates provided on this page are for informational and illustrative purposes only. They do not constitute professional, legal, or financial advice, and should not be relied upon as such. Because individual circumstances and regulatory requirements vary, these materials may not be suitable for your specific needs. We recommend consulting with a qualified professional before adapting or using any of these examples for official or commercial purposes.