How to Return All Values That Match Criteria in Excel?

Sharing is caring!

Microsoft Excel is widely used for organizing, analyzing, and filtering data. A common task users encounter is extracting all values that match specific criteria. This task can’t always be completed with basic formulas like VLOOKUP or IF, especially when you want multiple results instead of just one.

In this guide, you’ll learn how to return all matching values using different Excel methods like FILTER, INDEX, SMALL, IF, and array formulas. These techniques work across various use cases, from data analysis to report generation.

Why You Might Need to Return All Matching Values

There are many practical reasons why you might need to return multiple results:

  • Listing all orders for a specific customer
  • Getting all employees from a certain department
  • Extracting products sold in a specific region
  • Pulling all dates matching a condition

Traditional formulas like VLOOKUP or INDEX/MATCH return only the first match. To return all values, we need to use dynamic array formulas, helper columns, or Power Query.

Method 1: Use FILTER Function (Excel 365 & Excel 2021)

If you’re using Excel 365 or Excel 2021, the FILTER function is the easiest and most efficient method.

Syntax of FILTER

=FILTER(array, include, [if_empty])
  • array: The range to return results from
  • include: The condition to match
  • if_empty: Optional value to show if no results found

Example: Return All Sales by a Specific Salesperson

SalespersonRegionSales
JohnEast500
SarahWest300
JohnNorth450
MikeEast200

Formula:

=FILTER(A2:C5, A2:A5="John")

Result:

SalespersonRegionSales
JohnEast500
JohnNorth450

This returns all rows where the Salesperson is John.

Method 2: Use INDEX and SMALL with Array Formula (For Older Excel Versions)

For Excel versions prior to 365/2021, you can use INDEX, SMALL, IF, and ROW inside an array formula.

Suppose your data is in A2:A10 (Names) and B2:B10 (Scores). You want to get all scores where Name = “Alice”.

Step 1: Create a Helper Column (optional but useful)

In C2, enter:

=IF(A2="Alice",ROW(A2)-ROW(A$2)+1,"")

Drag it down. This gives you a relative row number where the match is found.

Step 2: Use INDEX and SMALL to Return Matching Values

In E2 (output column), enter:

=IFERROR(INDEX(B$2:B$10,SMALL(IF(A$2:A$10="Alice",ROW(A$2:A$10)-ROW(A$2)+1),ROW(1:1))),"")

Press Ctrl + Shift + Enter (for array entry) if you’re not using Excel 365.

Drag the formula down to get multiple results.

Method 3: Use Advanced Filter (Manual Way)

If you prefer a manual, UI-based method without formulas, Advanced Filter is a built-in feature in Excel.

  1. Select your data range (e.g., A1:C10)
  2. Go to Data > Advanced
  3. In the dialog box:
    • Choose “Copy to another location”
    • Set criteria range (e.g., E1:E2 where E1 is “Region” and E2 is “East”)
    • Set “Copy to” (e.g., G1)
  4. Click OK

It will return only matching records.

Method 4: Use Power Query to Extract Matching Values

Power Query is powerful for transforming and filtering data.

How to Use It:

  1. Select your data and go to Data > Get & Transform > From Table/Range
  2. In Power Query Editor:
    • Use the filter dropdown to choose your matching criteria
    • Click Close & Load to send results back to Excel

You can easily refresh this when your data changes.

Method 5: Use TEXTJOIN to Concatenate Matching Results

Sometimes, instead of listing values in rows, you might want to combine them into a single cell. The TEXTJOIN function works well for this.

Example: Combine All Products in Category “A”

ProductCategory
PenA
BookB
PencilA
EraserC

Formula:

=TEXTJOIN(", ", TRUE, IF(B2:B5="A", A2:A5, ""))

Press Ctrl + Shift + Enter if not in Excel 365.

Result: Pen, Pencil

This is useful when you want summary-style results in one cell.

Comparison of Methods to Return All Values That Match Criteria

MethodExcel Version RequiredDynamic OutputEasy to UpdateBest For
FILTER FunctionExcel 365, Excel 2021YesYesModern users, large datasets
INDEX + SMALL + IFExcel 2010 and laterNoSomewhatOlder Excel versions
Advanced FilterAll versionsNoManualOne-time extraction
Power QueryExcel 2016 and laterYesYesAutomated reports
TEXTJOIN + IFExcel 2016 and laterYesYesSummary in one cell

Tips for Working with Matching Criteria

  • Use named ranges to make formulas easier to read.
  • Always sort and clean your data before applying formulas.
  • Try to avoid hardcoding values (e.g., “John”); use a cell reference instead for flexibility.
  • For case-sensitive matches, use functions like EXACT inside your formula.

Example: Return All Orders by Customer Name

Order IDCustomerAmount
101Alice250
102Bob300
103Alice180
104Carol220

To get all orders by Alice, use:

=FILTER(A2:C5, B2:B5="Alice")

Or with a cell reference for flexibility:

=FILTER(A2:C5, B2:B5=E1)

Where E1 contains “Alice”.

Use Named Ranges for Cleaner Formulas

Instead of using A2:A100, create a named range like CustomerList and use it:

=FILTER(SalesData, CustomerList=G1)

This improves readability and reduces errors.

Handling Multiple Criteria

If you want to return rows that match more than one condition, you can use the * (AND) or + (OR) logic inside FILTER.

Example: Return All Sales by John in East Region

=FILTER(A2:C10, (A2:A10="John")*(B2:B10="East"))

This acts as an AND condition.

Handling Errors When No Match is Found

By default, if no results match in FILTER, Excel will return #CALC!. You can customize this using the third argument.

=FILTER(A2:C10, A2:A10="Derek", "No matches found")

This makes your workbook cleaner and more user-friendly.

Summary

Returning all values that match criteria in Excel is a vital skill for data analysis, reporting, and automation. Depending on your Excel version, you can choose between:

  • FILTER for dynamic and simple solutions
  • Array formulas using INDEX, SMALL, and IF for older versions
  • Power Query for structured, refreshable queries
  • Advanced Filter for quick manual results
  • TEXTJOIN for joining matching results into one cell

Each method has its strengths, so choose based on your needs and the Excel version you’re using. Mastering these will make you more efficient at handling complex data tasks in Excel.

FAQs

How do I return multiple matching values in Excel?

You can use the FILTER function in Excel 365/2021 to return all values that match specific criteria. In older versions, use a combination of INDEX, SMALL, and IF in an array formula.

Can I use the FILTER function in Excel 2016?

No, the FILTER function is available only in Excel 365 and Excel 2021. For Excel 2016, you can use array formulas or Power Query to return multiple matches.

How can I return all values in a single cell?

You can use the TEXTJOIN function along with IF to combine multiple matching values into a single cell. Make sure to enter it as an array formula if required.

What if no values match the criteria?

You can add an optional message in the FILTER function to handle cases where no values match. For example: =FILTER(A2:A10, B2:B10=”X”, “No matches found”).

Can I use multiple criteria with the FILTER function?

Yes, you can use logical operators like * for AND and + for OR inside the FILTER function to apply multiple criteria. Example: =FILTER(A2:C10, (A2:A10=”John”)*(B2:B10=”East”))

Is Power Query better than formulas for filtering data?

Power Query is excellent for transforming and automating data workflows. It’s a great option when working with large datasets or when you need repeatable queries.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *