Skip to content
Free Excel Tutorials
  • Home
  • Excel For Beginners
  • Excel Intermediate
  • Advanced Excel For Experts

Data Analysis

  • Managing Conditional Formatting Rules in Excel
  • How to Create Thermometer Chart in Excel
  • How to Create Gantt Chart in Excel
  • How to Create Area Chart in Excel
  • Create Scatter Chart in Excel

References

  • How to create dynamic named range with OFFSET in Excel
  • VLOOKUP function: Description, Usage, Syntax, Examples and Explanation
  • How to use Excel VLOOKUP Function
  • Merge tables with VLOOKUP in Excel
  • How to get last row in numeric data in Excel

Data Validations

  • Excel Data validation allow weekday only
  • Excel Data validation must contain specific text
  • Excel Data validation unique values only
  • Excel Data validation number multiple 100
  • Excel Data validation require unique number

Extract all partial matches in Excel

by

This tutorial shows how to Extract all partial matches in Excel using the example below;

Formula

=IF(F5>ct,"",INDEX(data,AGGREGATE(15,6,(ROW(data)-ROW($B$5)+1)/ISNUMBER(SEARCH(search,data)),F5)))

Explanation

To extract all matches based on a partial match, you can use use an array formula based on the INDEX and AGGREGATE functions, with support from ISNUMBER and SEARCH. In the example shown, the formula in G5 is:

=IF(F5>ct,"",INDEX(data,AGGREGATE(15,6,(ROW(data)-ROW($B$5)+1)/ISNUMBER(SEARCH(search,data)),F5)))

with the following named ranges: “search” = D5, “ct” = D8, “data” = B5:B55.

Note: this is an array formula, but it does not require control + shift + enter, since AGGREGATE can handle arrays natively.

How this formula works

The core of this formula is the INDEX function, with AGGREGATE used to figure out the “nth match” for each row in the extract area:

INDEX(data,nth_match_formula)

Almost all of the work is in figuring out and reporting which rows in “data” match the search string, and reporting the position of for each matching value to INDEX. This is done with the AGGREGATE function configured like this:

AGGREGATE(15,6,(ROW(data)-ROW($B$5)+1)/ISNUMBER(SEARCH(search,data)),F5)

The first argument, 15, tells AGGREGATE to behave like SMALL, and return nth smallest values. The second argument, 6, is an option to ignore errors. The third argument is an expression that generates an array of matching results (described below). The forth argument, F5, acts like “k” in SMALL to specify the “nth” value.

AGGREGATE operates on arrays, and the expression below builds an array for the third argument inside AGGREGATE :

(ROW(data)-ROW($B$5)+1)/ISNUMBER(SEARCH(search,data))

Here, the ROW function is used to generate an array of relative row numbers, and ISNUMBER and SEARCH are used together to match the search string against values in the data, which generates an array of TRUE and FALSE values.

The clever bit is to divide the row numbers by the search results. In a math operation like this, TRUE behaves like 1, and FALSE behaves like zero. The result is row numbers associated with a positive match are divided by 1 and survive the operation, while row numbers associated with non-matching values are destroyed and become #DIV/0 errors. Because AGGREGATE is set to ignore errors, it ignores the #DIV/0 errors, and returns the “nth” smallest number in the remaining values, using the number in column F for “nth”.

Managing performance

Like all array formulas, this formula is “expensive” in terms of resources with a large data set. To minimize performance impacts, the entire INDEX and MATCH formula is wrapped in IF like this:

=IF(F5>ct,"",formula)

where the named range “ct” (D8) holds this formula:

=COUNTIF(data,"*"&search&"*")

This check stops the the INDEX and AGGREGATE part of the formula from running once all matching values have been extracted.

Array formula with SMALL

If your version of Excel does not have the AGGREGATE function, you can use an alternative formula based on SMALL and IF:

=IF(F5>ct,"",INDEX(data,SMALL(IF(ISNUMBER(SEARCH(search,data)),ROW(data)-ROW($B$5)+1),F5)))

Note: this is an array formula and must be entered with control + shift + enter.

Post navigation

Previous Post:

COSH function: Description, Usage, Syntax, Examples and Explanation

Next Post:

Excel Data validation require unique number

Leave a Reply Cancel reply

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

Learn Basic Excel

Ribbon
Workbook
Worksheets
Format Cells
Find & Select
Sort & Filter
Templates
Print
Share
Protect
Keyboard Shortcuts

Categories

  • Charts
  • Data Analysis
  • Data Validation
  • Excel Functions
    • Cube Functions
    • Database Functions
    • Date and Time Functions
    • Engineering Functions
    • Financial Functions
    • Information Functions
    • Logical Functions
    • Lookup and Reference Functions
    • Math and Trig Functions
    • Statistical Functions
    • Text Functions
    • Web Functions
  • Excel VBA
  • Excel Video Tutorials
  • Formatting
  • Grouping
  • Others

Logical Functions

  • How to return blank in place of #DIV/0! error in Excel
  • NOT function: Description, Usage, Syntax, Examples and Explanation
  • XOR function: Description, Usage, Syntax, Examples and Explanation
  • IF with wildcards in Excel
  • How to use Excel OR Function

Date Time

  • Calculate date overlap in days in Excel
  • Add days exclude certain days of week in Excel
  • How to calculate next day of week in Excel
  • List holidays between two dates in Excel
  • Extract time from a date and time in Excel

Grouping

  • How to randomly assign people to groups in Excel
  • Group arbitrary text values in Excel
  • How to randomly assign data to groups in Excel
  • If cell contains one of many things in Excel
  • Group numbers with VLOOKUP in Excel

General

  • Count cells that do not contain errors in Excel
  • How to create dynamic worksheet reference in Excel
  • How to get amount with percentage in Excel
  • How to calculate total from percentage in Excel
  • Zoom Worksheet in Excel
© 2025 xlsoffice . All Right Reserved. | Teal Smiles | Abbreviations And Their Meaning