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

Data Analysis

  • Conditional Formatting Data bars Examples in Excel
  • How to conditionally sum numeric data in an Excel table using SUMIFS
  • How To Load Analysis ToolPak in Excel
  • Subtotal function in Excel
  • Use Data Form to input, edit and delete records in Excel

References

  • How to use Excel MMULT Function
  • Last row number in range
  • How to get address of last cell in range in Excel
  • Excel Advanced Lookup using Index and Match Functions
  • How to get address of first cell in range in Excel

Data Validations

  • Excel Data validation unique values only
  • Excel Data validation date in next 30 days
  • Excel Data validation whole percentage only
  • Excel Data validation date in specific year
  • Excel Data validation allow uppercase only

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

  • Nested IF function example in Excel
  • OR function Examples in Excel
  • AND function: Description, Usage, Syntax, Examples and Explanation
  • IF function: Description, Usage, Syntax, Examples and Explanation
  • How to use Excel OR Function

Date Time

  • HOUR function: Description, Usage, Syntax, Examples and Explanation
  • Get days between dates ignoring years in Excel
  • TIME function: Description, Usage, Syntax, Examples and Explanation
  • DATE function: Description, Usage, Syntax, Examples and Explanation
  • Calculate series of dates by workdays in Excel

Grouping

  • Calculate conditional mode with criteria in Excel
  • How to randomly assign people to groups in Excel
  • If cell contains one of many things in Excel
  • Map inputs to arbitrary values in Excel
  • Group numbers with VLOOKUP in Excel

General

  • How to create dynamic named range with INDEX in Excel
  • How to get amount with percentage in Excel
  • 44 Practical Excel IF function Examples
  • How to Create Calendar in Excel
  • Spell Check in Excel
© 2025 xlsoffice . All Right Reserved. | Teal Smiles | Abbreviations And Their Meaning