How to Search for Text in an Excel Range Using Formulas

📅 Oct 10, 2026 📝 Sarah Miller

Locating specific text across vast Excel data ranges can be tedious, stalling critical analysis. When auditing spreadsheets that track standard funding sources like venture capital or bank loans, manual filtering is highly inefficient. Utilizing a dynamic search formula grants users instant visibility into complex datasets.

Stipulation: This approach requires precise syntax and helper columns for array searches to function correctly. For instance, combining ISNUMBER and SEARCH easily flags entries like "Federal Grant" across multiple rows.

Below, we break down the exact formulas, syntax rules, and step-by-step workflows to automate your data retrieval.

How to Search for Text in an Excel Range Using Formulas

Excel Formula to Search Text in Range: A Comprehensive Guide

Searching for specific text within a range of cells is one of the most common tasks in Excel. Whether you are auditing a financial ledger, managing an inventory list, or analyzing customer feedback, finding data efficiently saves hours of manual work. Depending on your version of Excel and your specific goals-whether you want to find an exact match, perform a partial match, handle case sensitivity, or return the actual cell location-Excel offers several powerful formulas to get the job done.

In this guide, we will explore the best formulas to search for text in a range, progressing from simple checks to advanced dynamic array solutions.

1. Check if Text Exists in a Range (Yes/No or TRUE/FALSE)

Often, you do not need to extract the data; you simply need to know if a specific text string exists within a range. The easiest way to achieve this is by using the COUNTIF or COUNTIFS function.

Using COUNTIF for Exact Match

The COUNTIF function counts the number of cells in a range that meet a specific condition. If the count is greater than zero, the text exists.

=COUNTIF(A2:A20, "Apple") > 0

How it works: Excel scans the range A2:A20 for the exact word "Apple". If it finds it, it returns a count (e.g., 2). The > 0 comparison converts this count into a logical TRUE or FALSE.

Using COUNTIF with Wildcards for Partial Match

If you want to search for a partial text match (e.g., finding "Apple" within "Green Apple" or "Apple Pie"), you can use wildcard characters. The asterisk (*) represents any number of characters.

=COUNTIF(A2:A20, "*Apple*") > 0

This formula returns TRUE if any cell in the range contains the sequence "Apple", regardless of what text comes before or after it.

2. Locate and Retrieve Text Using INDEX and MATCH

If you want to find a text string in a range and retrieve a corresponding value from another column, the classic INDEX and MATCH combination is your best tool. This method works across all versions of Excel.

Formula for Partial Text Search:

=INDEX(B2:B20, MATCH("*Apple*", A2:A20, 0))

How This Formula Works:

  • MATCH("*Apple*", A2:A20, 0): The MATCH function searches for the wildcard string "*Apple*" in the lookup range A2:A20. The 0 specifies an exact match. It returns the relative row number where the match is found (e.g., row 5).
  • INDEX(B2:B20, ...): The INDEX function takes that row number and retrieves the corresponding value from the return range B2:B20.

3. The Modern Solution: XLOOKUP (Excel 365 & Excel 2021)

If you are using Microsoft 365 or Excel 2021, the modern XLOOKUP function simplifies partial and exact text searches significantly. It replaces both VLOOKUP and the INDEX/MATCH combo.

XLOOKUP with Wildcard Matching

By default, XLOOKUP looks for exact matches. To enable wildcards, you must configure its fifth argument (match mode) to 2.

=XLOOKUP("*Apple*", A2:A20, B2:B20, "Not Found", 2)

Breakdown of Arguments:

Argument Value in Example Description
Lookup Value "*Apple*" The text to find, using wildcards for partial match.
Lookup Array A2:A20 The range where Excel will search for the text.
Return Array B2:B20 The range from which the corresponding value is retrieved.
If Not Found "Not Found" A custom message returned if no match is found.
Match Mode 2 Instructs Excel to enable wildcard character matching.

4. Filter All Rows Containing Specific Text (Dynamic Arrays)

Sometimes, returning just the first match isn't enough. If you want to extract all records that contain a specific text string from a range, you can use the dynamic FILTER function combined with ISNUMBER and SEARCH.

The Formula:

=FILTER(A2:C20, ISNUMBER(SEARCH("Apple", A2:A20)), "No matching data")

How This Multi-Step Formula Works:

  1. SEARCH("Apple", A2:A20): The SEARCH function is case-insensitive. It checks every cell in range A2:A20 for the word "Apple". If found, it returns the starting character position as a number (e.g., 1 or 7). If not found, it returns a #VALUE! error.
  2. ISNUMBER(...): This wraps the SEARCH function. It converts the numbers to TRUE and the errors to FALSE, creating an array of logical values (e.g., {TRUE; FALSE; TRUE; ...}).
  3. FILTER(A2:C20, ...): The FILTER function extracts all rows from the dataset A2:C20 where the corresponding value in the array is TRUE.

5. Case-Sensitive Text Search in a Range

Standard Excel search functions like SEARCH and COUNTIF are case-insensitive. If you need to distinguish between "apple", "Apple", and "APPLE", you must use the case-sensitive FIND function instead of SEARCH.

Case-Sensitive Check:

=SUMPRODUCT(--ISNUMBER(FIND("Apple", A2:A20))) > 0

Why use SUMPRODUCT?

Because FIND does not naturally handle arrays without helper functions in older Excel versions, SUMPRODUCT forces Excel to evaluate the formula across the entire range A2:A20.

  • FIND("Apple", A2:A20) searches case-sensitively, returning numbers or errors.
  • ISNUMBER(...) converts those results to TRUE or FALSE.
  • The double unary operator (--) converts TRUE to 1 and FALSE to 0.
  • SUMPRODUCT sums those numbers. If the sum is greater than 0, a case-exact match exists.

6. Search for Multiple Text Strings in a Range

What if you want to find cells that contain either "Apple" OR "Orange"? You can achieve this by combining SUMPRODUCT with sign logic, or by using a modified FILTER function.

Search with OR Logic (Match "Apple" OR "Orange")

=FILTER(A2:B20, ISNUMBER(SEARCH("Apple", A2:A20)) + ISNUMBER(SEARCH("Orange", A2:A20)), "No match")

In Excel logic, addition (+) acts as an OR operator. If either search returns a number (which ISNUMBER turns into TRUE/1), the cell is included in the filtered results.

Search with AND Logic (Match both "Green" AND "Apple")

=FILTER(A2:B20, ISNUMBER(SEARCH("Green", A2:A20)) * ISNUMBER(SEARCH("Apple", A2:A20)), "No match")

Multiplication (*) acts as an AND operator. A row will only be returned if both search queries evaluate to TRUE (1 * 1 = 1).

Summary of Search Formula Options

To choose the best formula for your Excel worksheet, review this quick summary table:

Objective Recommended Formula Excel Version Compatibility
Check if exact text exists =COUNTIF(range, "text") > 0 All Versions
Check if partial text exists =COUNTIF(range, "*text*") > 0 All Versions
Find first match and return value =XLOOKUP("*text*", lookup_range, return_range, , 2) Office 365 / Excel 2021
Find and return matching value (legacy) =INDEX(return_range, MATCH("*text*", lookup_range, 0)) All Versions
Extract all rows matching a text string =FILTER(data, ISNUMBER(SEARCH("text", range))) Office 365 / Excel 2021
Case-sensitive search and extract =FILTER(data, ISNUMBER(FIND("Text", range))) Office 365 / Excel 2021

Pro-Tip: Managing Errors

When writing search formulas, especially those involving MATCH, INDEX, or VLOOKUP, you may encounter #N/A errors if the text is not found. You can keep your spreadsheets clean and professional by nesting your search formulas inside the IFERROR function:

=IFERROR(INDEX(B2:B20, MATCH("*Apple*", A2:A20, 0)), "Not Found")

This ensures that instead of an ugly error message, your users will see a clean, descriptive notice like "Not Found".

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.