Excel Formulas to Return Multiple Matching Values Horizontally

📅 Sep 04, 2026 📝 Sarah Miller

Many financial analysts struggle to extract and align multiple matching records horizontally, as standard lookup functions fail when duplicate keys exist. When consolidating data from standard funding sources, static tools often fall short of capturing the full dataset. Fortunately, utilizing modern dynamic array formulas grants immediate, horizontal clarity across all matching allocations without tedious manual sorting. However, as a key stipulation, this advanced methodology requires Excel 365 or Excel 2021 to support dynamic arrays. Top corporate treasury departments rely on this exact technique to map multi-tranche disbursements. Below, we will explore the precise syntax using TRANSPOSE and FILTER to achieve this seamless horizontal alignment.

Excel Formulas to Return Multiple Matching Values Horizontally

Excel Formula to Match and Return Multiple Values Horizontally

Excel is an incredibly powerful tool for data analysis, but users frequently run into limitations with standard lookup functions. If you have ever used VLOOKUP, HLOOKUP, or XLOOKUP, you know that they are designed to find a match and return the first corresponding value they encounter. But what happens when your dataset contains multiple matches for a single lookup value, and you need to retrieve all of them and list them horizontally across a row?

Whether you are assigning projects to team members, listing products under specific categories, or grouping students by class, extracting multiple matches horizontally is a common requirement. In this comprehensive guide, we will explore the best formulas and techniques to achieve this in Excel, ranging from modern dynamic array formulas to classic compatibility formulas for older Excel versions.

---

The Sample Dataset

To illustrate these methods, let's assume we have a simple dataset containing project assignments. We want to look up a Project Name and return all Team Members assigned to that project, spreading the names horizontally across columns.

Project Name (Column A) Team Member (Column B)
Project AlphaAlice
Project BetaBob
Project AlphaCharlie
Project GammaDavid
Project AlphaEva
Project BetaFrank

Our goal is to type Project Alpha in cell D2 and have Excel automatically populate Alice, Charlie, and Eva in cells E2, F2, and G2.

---

Method 1: The Modern Way – FILTER & TRANSPOSE (Excel 365 & 2021+)

If you are using Excel 365, Excel 2021, or Excel for the Web, you have access to dynamic arrays. This makes retrieving multiple matches horizontal incredibly simple. We combine two powerful functions: FILTER and TRANSPOSE.

The Formula

=TRANSPOSE(FILTER(B2:B7, A2:A7 = D2, ""))

How It Works

  1. FILTER(B2:B7, A2:A7 = D2, ""): This function inspects the range A2:A7 for values matching D2 ("Project Alpha"). It returns a vertical array of all matching values from B2:B7 (Alice, Charlie, and Eva). If no matches are found, it returns an empty string ("").
  2. TRANSPOSE(...): By default, the FILTER function outputs its results vertically (down a column). Wrapping the formula in TRANSPOSE rotates this vertical array into a horizontal array, spilling the results across the columns to the right.

Advantages

  • Dynamic Spilling: You only need to type this formula in a single cell (e.g., E2). Excel automatically "spills" the results into adjacent columns. If you add or remove matches in your data, the horizontal list updates automatically.
  • No Dragging Required: No need to copy the formula across columns manually.
---

Method 2: The Classic Way – INDEX, SMALL, IF, & COLUMN (Excel 2019 and Older)

If you are working in Excel 2019, 2016, 2013, or earlier, you do not have access to the FILTER or TRANSPOSE functions. Instead, you must use a traditional array formula. This method is more complex but highly reliable for backward compatibility.

The Formula

Enter this formula in cell E2 and press Ctrl + Shift + Enter (if you are on Excel 2019 or older) to enter it as an array formula. Then, drag the fill handle to the right across as many columns as needed.

=IFERROR(INDEX($B$2:$B$7, SMALL(IF($A$2:$A$7=$D$2, ROW($A$2:$A$7)-ROW($A$2)+1), COLUMN(A1))), "")

Detailed Breakdown of How It Works

This formula works like a search engine filtering through rows one by one. Here is the step-by-step breakdown:

  • IF($A$2:$A$7=$D$2, ROW($A$2:$A$7)-ROW($A$2)+1): This evaluates each cell in our lookup range. If a row matches "Project Alpha", it calculates its relative row position inside our range (e.g., Row 1, Row 3, Row 5). If it does not match, it returns FALSE. This produces an array like: {1; FALSE; 3; FALSE; 5; FALSE}.
  • COLUMN(A1): This acts as a dynamic counter. In cell E2, COLUMN(A1) returns 1. When you drag the formula to the right into cell F2, it changes to COLUMN(B1), which returns 2, and so on.
  • SMALL(..., COLUMN(A1)): The SMALL function returns the n-th smallest value from an array. In the first column (where column counter is 1), it returns the 1st smallest number (which is 1). In the next column (where column counter is 2), it returns the 2nd smallest number (which is 3). This targets the exact row indices containing our matches.
  • INDEX($B$2:$B$7, ...): The INDEX function retrieves the team member name at the row index specified by the SMALL function.
  • IFERROR(..., ""): Once Excel runs out of matches, the formula will return a #NUM! error. The IFERROR function catches this and displays a clean, blank cell instead.
---

Method 3: Power Query (The Non-Formula Alternative)

If you have a massive dataset or prefer not to use complex formulas, Excel's built-in Power Query tool is an excellent alternative. It allows you to transform and shape your data with just a few clicks.

Step-by-Step Instructions

  1. Select your source table, navigate to the Data tab, and click From Table/Range. This opens the Power Query Editor.
  2. In the Power Query Editor, select the Project Name column.
  3. Go to the Transform tab and click on Group By.
  4. In the Group By dialog:
    • Set the Operation to All Rows.
    • Name the new column (e.g., "AllData"). Click OK.
  5. Add a custom column to extract the list of team members. Go to the Add Column tab, click Custom Column, and enter this formula:
    Table.Column([AllData], "Team Member")
  6. Click the expand icon next to your new list column and select Extract Values. Choose a delimiter (like a comma or semicolon).
  7. Select your newly extracted column, go to the Transform tab, and click Split Column -> By Delimiter. Power Query will automatically split these values into separate columns.
  8. Click Close & Load to return the clean, horizontally structured data back to your Excel worksheet.
---

Choosing the Right Method for Your Needs

To help you decide which approach is best suited for your specific workbook, refer to the comparison table below:

Method Excel Version Compatibility Pros Cons
FILTER & TRANSPOSE Office 365 / 2021+ Extremely fast, simple syntax, automatically scales. Not compatible with older Excel versions.
INDEX / SMALL Array All Versions (Excel 2010+) Highly compatible; works in any Excel environment. Complex syntax, heavy on CPU resources for large sheets.
Power Query Excel 2013+ (Add-in/Built-in) Handles millions of rows, clean UI-based approach. Requires manual refresh; not fully dynamic in real-time.
---

Conclusion

Matching and returning multiple values horizontally no longer has to be a structural headache in Excel. If you have the luxury of using modern Excel versions, the TRANSPOSE(FILTER(...)) combination is undoubtedly the cleanest, fastest, and most intuitive solution available. However, for legacy spreadsheet support, mastering the INDEX, SMALL, and ROW array formula remains an essential skill for any advanced Excel user.

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.