Dynamically Transpose Rows to Columns Based on Partial Matches in Excel

📅 Jul 05, 2026 📝 Sarah Miller

Manually reorganizing scattered row data is a persistent, time-consuming challenge for financial analysts. When tracking standard funding sources, critical information often resides in mismatched, unstructured rows rather than clean columns. Dynamically transposing this data based on partial text matches-such as isolating "Federal Grants" or "Municipal Allocations"-grants decision-makers immediate visibility and automated reporting precision.

Stipulation: This dynamic method requires Excel 365 or Excel 2021 to support dynamic array engines.

Below, we will step through the exact formula architecture combining TRANSPOSE, FILTER, and SEARCH to automate your data restructuring.

Dynamically Transpose Rows to Columns Based on Partial Matches in Excel

Introduction

Data normalization is a standard practice in database management, but it often leaves us with long, vertical datasets that are difficult to read at a glance. In Excel, a common challenge arises when you need to extract specific records based on a partial match and pivot them horizontally. For example, you might want to look up all transaction descriptions containing the word "Software" and list their corresponding prices across a single row in adjacent columns.

Historically, solving this problem required complex VBA macros or volatile array formulas entered with Ctrl + Shift + Enter. Today, thanks to Excel's modern Dynamic Array engine, we can construct elegant, fully dynamic formulas using functions like FILTER, SEARCH, ISNUMBER, and TRANSPOSE (or TOROW).

In this comprehensive guide, we will walk you through the step-by-step process of building an Excel formula that dynamically searches, filters, and transposes partial-match rows to columns, adapting instantly as your source data changes.

The Practical Scenario

To understand how this works, let's establish a sample dataset. Imagine you run an IT consultancy and have a tracking sheet of expenses. The descriptions are detailed and contain category keywords alongside specific invoice IDs.

Transaction ID (Col A) Description (Col B) Amount (Col C)
TXN-101 Adobe Creative Cloud Subscription $52.99
TXN-102 AWS Cloud Hosting US-East $312.50
TXN-103 Office Supplies Depot $45.00
TXN-104 Github Enterprise Seats $125.00
TXN-105 AWS Cloud Backup Service $89.00
TXN-106 Microsoft 365 Business Renewal $150.00

The Goal: We want to extract all amounts associated with the partial match keyword "Cloud" and display them horizontally in a row like this:

Search Term Match 1 Match 2 Match 3
Cloud $52.99 $312.50 $89.00

Understanding the Core Components

To achieve this dynamically, we must combine several modern Excel functions. Let's break down the logic of how these functions communicate with one another:

  • SEARCH("Cloud", B2:B7): This function scans each cell in the Description range. If it finds the word "Cloud" (case-insensitive), it returns the starting character position (a number). If it doesn't find it, it returns a #VALUE! error.
  • ISNUMBER(...): This converts the numeric positions and errors from the SEARCH step into boolean values (TRUE or FALSE). This creates our filter mask.
  • FILTER(C2:C7, Mask): The filter function extracts only the values in the Amount column where our mask is TRUE.
  • TRANSPOSE(...) or TOROW(...): By default, the FILTER function outputs results vertically in a column. Wrapping it in TRANSPOSE or TOROW pivots these vertical results into a horizontal row.

Step-by-Step Formula Construction

Step 1: Locate the Partial Matches

First, we test our range for partial matches. If our search term "Cloud" is housed in cell E2, the search formula is:

=SEARCH(E2, B2:B7)

This evaluates to an array: {7; 5; #VALUE!; #VALUE!; 11; #VALUE!}.

Step 2: Convert to Booleans

Next, we wrap the search in ISNUMBER to filter out the errors:

=ISNUMBER(SEARCH(E2, B2:B7))

This yields: {TRUE; TRUE; FALSE; FALSE; TRUE; FALSE}.

Step 3: Extract the Corresponding Values

Now, we feed this logical array into the FILTER function to retrieve the matching values from Column C:

=FILTER(C2:C7, ISNUMBER(SEARCH(E2, B2:B7)), "No Matches Found")

The third argument, "No Matches Found", is a fallback that prevents a #CALC! error if no records match your search criteria.

Step 4: Transpose Rows into Columns

Currently, the formula spills the filtered amounts down vertically. To spill them across columns, wrap the entire expression in the TRANSPOSE function:

=TRANSPOSE(FILTER(C2:C7, ISNUMBER(SEARCH(E2, B2:B7)), ""))

Alternatively, if you are using Microsoft 365, you can use the newer and more specialized TOROW function:

=TOROW(FILTER(C2:C7, ISNUMBER(SEARCH(E2, B2:B7)), ""))

Optimizing the Formula with LET for Performance

When working with large datasets, calculating the same range multiple times can slow down your workbook. We can use the LET function to declare variables. This makes the formula easier to read, modify, and faster for Excel to compute:

=LET(
    searchTerm, E2,
    searchRange, B2:B1000,
    returnRange, C2:C1000,
    matches, ISNUMBER(SEARCH(searchTerm, searchRange)),
    filteredData, FILTER(returnRange, matches, ""),
    TOROW(filteredData)
)

With this configuration, if your data columns change, you only have to update the references once at the top of the LET function block.

Advanced Scenario: Case-Sensitive Search

By default, SEARCH is case-insensitive. It treats "cloud", "Cloud", and "CLOUD" identically. If your data structure requires a case-sensitive match (e.g., distinguishing between "aws" and "AWS"), simply swap the SEARCH function for FIND:

=TOROW(FILTER(C2:C7, ISNUMBER(FIND(E2, B2:B7)), ""))

Handling Common Errors

1. The #SPILL! Error

A #SPILL! error occurs when Excel attempts to write the transposed rows across the columns, but there is already data in the way. To fix this:

  • Ensure that the cells to the right of your formula are completely empty.
  • Do not try to write formulas in adjacent columns where your data is expected to expand.

2. No Matches Returning Blank

If your partial match criteria is broad or misspelled, the formula might return an empty cell. It is always best practice to utilize the third argument of the FILTER function to output a clean message like "No matches" or "-".

Alternative: Scaling Across Multiple Criteria Rows

If you have a list of different search terms in column E (e.g., "Cloud" in E2, "Office" in E3, "Adobe" in E4) and want to drag the formula down to create a structured matrix, make sure to absolute-reference your data sources:

=TOROW(FILTER($C$2:$C$100, ISNUMBER(SEARCH(E2, $B$2:$B$100)), ""))

By using the $ signs on the lookup arrays but keeping E2 relative, you can safely drag this formula down. Each row will independently query the database and spill its matches horizontally next to its corresponding keyword.

Conclusion

Pivoting partial-match row data into dynamic columns is an incredibly efficient way to summarize unstructured logs, financial statements, and inventory sheets. By combining the powers of FILTER, ISNUMBER, SEARCH, and TOROW, you bypass legacy Excel limitations and build worksheets that update automatically as transactions are added or modified. Implement these formulas in your next dashboard to experience the clean organization of modern Excel dynamic arrays!

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.