How to Filter Text Contains in Excel
Learn multiple Excel methods to filter rows that contain specific text, with step-by-step examples, business use cases, and advanced tips.
How to Filter Text Contains in Excel
Why This Task Matters in Excel
A modern spreadsheet is rarely just numbers; it is packed with descriptive labels, product codes, customer comments, job titles, and other text strings that drive decision-making. Being able to quickly isolate the rows that contain a certain word or fragment—rather than match it exactly—can drastically reduce the time it takes to surface important insights.
Imagine a customer-service manager who maintains an issue log in Excel. Hundreds of new tickets pour in daily, each with a free-form description. The manager needs to pull every record that mentions “refund” so that the finance team can prioritize them. Without a reliable “text contains” filter, the manager would be left scrolling or sorting manually—an inefficient and error-prone process that delays customer resolutions.
Similar scenarios exist across industries:
- Retail analysts filtering product SKUs that contain “XL” or “Kids.”
- Marketing teams isolating email subjects with “opt-out” before compliance checks.
- IT departments flagging log entries that include “timeout” or “failed” for incident reports.
- Human resources professionals retrieving job titles containing “Manager” to assess leadership distribution.
Excel is uniquely valuable for these tasks because it supports both point-and-click filtering (AutoFilter) and fully reproducible, shareable formula-based filtering (FILTER, Advanced Filter, Power Query). Combined with functions such as SEARCH, FIND, and COUNTIF, you can build dynamic dashboards that automatically refresh when the source data changes—something impossible with static ad-hoc filters.
Failing to master this skill leads to hidden trends, missed compliance deadlines, and duplicated effort each time new data arrives. Learning “text contains” filtering not only speeds up one-time analyses but also plugs seamlessly into broader workflows such as dynamic charting, pivot tables, and automated reporting pipelines.
Best Excel Approach
For workbooks created in Microsoft 365 or Excel 2021+, the FILTER function paired with SEARCH (or FIND for case sensitivity) is the fastest and most maintainable solution. FILTER returns entire rows that meet a logical test, while SEARCH tells us whether a fragment exists anywhere inside a target text string. Because both are dynamic array functions, the result automatically resizes as data grows or criteria change—ideal for live dashboards and templates.
General pattern:
=FILTER(Table1, ISNUMBER(SEARCH(criteria, Table1[TargetColumn])), "")
criteria– the text fragment you are looking for; can be hard-coded, referenced from a cell, or wrapped in other functions.Table1[TargetColumn]– the range or structured column where you want to search.""– the value to return if nothing matches (optional).
When might you not use this approach?
- You are limited to Excel 2019 or earlier (FILTER is unavailable).
- You need to combine data from multiple tables, de-duplicate, or transform columns extensively—in which case Power Query might be better.
- You want a one-off, non-formula approach for quick inspection, where AutoFilter is fastest.
Alternative syntax examples:
Case-sensitive:
=FILTER([A2:D100], ISNUMBER(FIND("USB", [A2:A100])), "No match")
Multiple fragments (OR logic):
=FILTER([A2:D100], (ISNUMBER(SEARCH("USB", [A2:A100])) + ISNUMBER(SEARCH("Thunderbolt", [A2:A100]))) > 0, "")
Parameters and Inputs
-
Source range or Table
- Can be a standard range like [A2:D100] or an official Excel Table (e.g.,
SalesData). - Each column should hold a single data type for easier validation.
- Can be a standard range like [A2:D100] or an official Excel Table (e.g.,
-
Search column
- Typically a single text column (e.g.,
Product,Comments,Title). - Ensure no numbers are stored as numeric type if you expect to find text fragments within them.
- Typically a single text column (e.g.,
-
Criteria
- Text fragment(s) to search for.
- Case-insensitive when you use SEARCH; case-sensitive when you use FIND.
- Can include wildcard characters when using COUNTIF or Advanced Filter, but not inside SEARCH.
-
Optional spill location
- Place the formula where you want the filtered table to appear.
- Ensure the surrounding cells are empty to avoid the #SPILL! error.
-
Error handling
- FILTER’s third argument controls what shows when no match exists.
- Wrap with IFERROR for more complex messaging or fallbacks.
Edge-case considerations:
- Cells containing errors will propagate unless you wrap SEARCH or FIND with IFERROR.
- Very large ranges (beyond 100k rows) may require performance tuning—e.g., limit the column set or convert to Power Query.
- SEARCH returns 1 for the first character position, so ISNUMBER(SEARCH()) is the standard way to get TRUE/FALSE logic.
Step-by-Step Examples
Example 1: Basic Scenario
Objective: Extract all product rows that contain the word “USB” in their description.
Sample data setup (rows 2-11):
| A (SKU) | B (Description) | C (Price) |
|---|---|---|
| P-001 | USB-C Cable 1m | 12.99 |
| P-002 | HDMI to VGA Adapter | 15.50 |
| P-003 | USB-A 4-Port Hub | 19.00 |
| P-004 | Ethernet Patch Cat6 | 8.25 |
| P-005 | Wireless Mouse | 24.70 |
| P-006 | USB-C to Lightning Cable 2m | 18.99 |
| P-007 | DisplayPort Cable | 11.99 |
| P-008 | USB Flash Drive 32 GB | 9.99 |
| P-009 | VGA Extension Cable | 7.80 |
| P-010 | USB 3.0 External HDD 1 TB | 49.99 |
Steps:
- Convert the data into a proper Excel Table. Select any cell in the range and press Ctrl + T. Name the table
Productsfor clarity. - In cell E2 (outside the table), type the following:
=FILTER(Products, ISNUMBER(SEARCH("USB", Products[Description])), "No USB items")
- Press Enter. The formula spills rows dynamically starting in E2, including entire rows from the table (all columns) that pass the criteria.
- Verify: Results should include SKUs P-001, P-003, P-006, P-008, P-010.
- Test dynamic behavior: Add a new row 12 with “USB Webcam,” and watch it auto-appear in the spill range without editing the formula.
Why it works:
- SEARCH returns the position of “USB” within each description string.
- ISNUMBER turns those positions into TRUE (numeric) or FALSE (error).
- FILTER uses that boolean array to decide which rows to return.
Common variations:
- Make “USB” a cell reference (e.g., G1) so non-technical users can type new criteria.
- Wrap SEARCH with LOWER() and criteria with LOWER() to achieve case-insensitive matching when mixed cases might break FIND.
Troubleshooting tips:
- If only headers show, ensure the search column is indeed text and contains “USB.”
- #SPILL! error? Check for non-empty cells blocking the output area.
Example 2: Real-World Application
Scenario: An HR department maintains a 10 000-row Employees table with columns: EmpID, FullName, JobTitle, Department, HireDate, Salary. Management wants an always-up-to-date list of employees whose job title includes “Manager” sent to senior leadership.
Steps
- Insert a new worksheet named “Mgr_List.”
- In cell A1 of “Mgr_List,” add headers identical to the
Employeestable so downstream VLOOKUPs or Power BI connections remain consistent. - In cell A2, enter:
=FILTER(Employees, ISNUMBER(SEARCH("Manager", Employees[JobTitle])), "No managers found")
- Format the output as a Table if needed, but do not overwrite the dynamic array formula. Instead, use the spill range as the data source for pivot tables or charts.
- Create a pivot chart on the same sheet summarizing headcount by Department, using the spill range as the source. Because FILTER is dynamic, the pivot refreshes instantly when new employees with “Manager” in their title are added—or when someone leaves.
Business value:
- Automates a previously manual audit.
- Eliminates version control problems because only one formula drives both the filtered list and any downstream analysis.
- When combined with conditional formatting, senior leaders get color-coded alerts if the count of managers exceeds budgeting guidelines.
Performance considerations:
- On 10 000 rows with six columns, FILTER recalculates instantly on modern hardware.
- If you add volatile functions or complex nested SEARCHES, consider limiting the columns returned (
[Employees[EmpID],Employees[JobTitle]]) to improve efficiency.
Example 3: Advanced Technique
Scenario: In a customer support log, you need rows that contain “refund” or “exchange,” but you must exclude rows that also contain the word “denied.” You also require case-sensitive matches because “Refund” (capital R) indicates completed cases, whereas lowercase “refund” signals pending ones.
Steps
- Assume the log resides in a Table called
Ticketswith columnsDate,TicketID,Subject,Status. - In a new sheet, cell A2:
=FILTER(
Tickets,
(
(ISNUMBER(FIND("Refund", Tickets[Subject])) + ISNUMBER(SEARCH("exchange", Tickets[Subject])) ) *
(ISNUMBER(SEARCH("denied", Tickets[Subject])) = FALSE)
) > 0,
"No matching tickets"
)
Explanation:
ISNUMBER(FIND("Refund", …))is case-sensitive and returns TRUE only for “Refund” with capital R.ISNUMBER(SEARCH("exchange", …))is case-insensitive.- The plus operator adds the two TRUE/FALSE arrays, creating OR logic.
- Multiplication enforces AND logic with the exclusion test
(ISNUMBER(SEARCH("denied", …)) = FALSE). - FIND triggers an error if “Refund” is not found, but ISNUMBER converts to FALSE.
Edge cases handled:
- If the subject includes both “Refund” and “denied,” the exclusion wins.
- Empty Subject cells return FALSE because FIND/SEARCH error out, safely ignored by ISNUMBER.
Professional tips:
- For readability, break the logic into helper columns named
ContainsRefund,ContainsExchange,ContainsDenied, then combine them in the FILTER formula. - Use
LETto define internal variables and shorten long formulas (Excel 365).
Performance optimization: On very large logs (200k+ rows), nest FILTER inside another FILTER to pre-limit by date range before evaluating text. This reduces computation overhead.
Tips and Best Practices
- Use Tables and structured references – They expand automatically as data grows, so FILTER never misses new entries.
- Isolate criteria in named cells – Non-technical users can update criteria without touching formulas.
- Combine IFERROR with SEARCH – Prevents visible errors when the search term is absent.
- Leverage LET – Store reusable calculations like
ContainsUSBto make complex logic readable and faster. - Test performance on partial ranges first – Then scale up, so you can pinpoint bottlenecks early.
- Document formulas with comments – Use the N() function or Excel’s native Notes to explain multi-criteria logic for future maintainers.
Common Mistakes to Avoid
- Forgetting case sensitivity differences – SEARCH is case-insensitive; FIND is not. Mixing them leads to unexpected omissions. Always choose deliberately.
- Leaving output range obstructed – Any non-empty cell blocks a dynamic array, triggering #SPILL!. Clear the surrounding area or turn the spill range vertical instead of horizontal.
- Hard-coding criteria in quotes – Makes future updates tedious and error-prone. Reference a dedicated criteria cell instead.
- Filtering entire worksheet unnecessarily – Using [A:D] when only one column decides inclusion wastes resources. Filter on the minimal necessary array.
- Ignoring hidden characters – Imported CSVs may contain non-breaking spaces that make SEARCH fail. Use TRIM and CLEAN on the source column when results look incomplete.
Alternative Methods
When FILTER is unavailable or not ideal, several other options exist.
| Method | Excel Version | Pros | Cons |
|---|---|---|---|
| AutoFilter (drop-down) | All versions | Easiest, no formulas; supports “Contains” text filter via UI | Manual; doesn’t update automatically; not portable across files without macros |
| Advanced Filter | All versions | Can copy results to another location; supports wildcard “text” | Requires re-running to refresh; UI is less intuitive |
| COUNTIF helper column + Table filter | All versions | Works in formulas; performant; enables multiple criteria | Adds extra column; not fully dynamic unless wrapped in FILTER |
| Power Query | Excel 2016+ | Handles massive data; supports complex transformations and loads back to sheet or data model | Learning curve; requires refresh; not instantaneous for users unfamiliar with PQ |
| VBA Macro | Any with macros enabled | Fully automated; can tie to buttons or events | Security warnings; maintenance overhead; not allowed in some corporate environments |
When to switch methods:
- If your workbook must be backward compatible with Excel 2013, choose Advanced Filter or COUNTIF helper columns.
- For datasets exceeding a million rows, load to Power Query and filter there, then summarize in Power Pivot.
FAQ
When should I use this approach?
Use the SEARCH+FILTER pattern whenever you need a live, formula-based subset of data that updates automatically as you edit either the source range or the criteria text. It shines in dashboards, templates, and collaborative workbooks where multiple users rely on a single source of truth.
Can this work across multiple sheets?
Yes. Reference the source table with the sheet name prefix, e.g., =FILTER('RawData'!A2:E1000, ISNUMBER(SEARCH(G1, 'RawData'!C2:C1000))). The spill range can be on any sheet, including one that is later hidden to protect formula integrity.
What are the limitations?
FILTER is unavailable in Excel 2019 and earlier. Dynamic arrays cannot spill into merged cells. SEARCH cannot use wildcards, and its performance degrades slightly on multi-hundred-thousand-row datasets. Workarounds include splitting data into smaller tables or using Power Query.
How do I handle errors?
Wrap SEARCH in IFERROR to convert errors to FALSE in complex logical stacks. Alternatively, use FILTER’s third argument to provide user-friendly messages. For example:
=FILTER(Data, ISNUMBER(SEARCH(G1, Data[Comment])), "No records matched. Check spelling.")
Does this work in older Excel versions?
Without FILTER, replicate the logic in a helper column:
=--ISNUMBER(SEARCH($G$1, B2))
Then filter the helper column for 1. Or use Advanced Filter with criteria [Subject] containing *refund*.
What about performance with large datasets?
Limit the number of columns passed into FILTER, avoid volatile functions inside the logical test, and consider converting the workbook to a binary format (.xlsb) for faster recalculation. For very large inputs, offload to Power Query where transformations run outside the calculation engine.
Conclusion
Mastering “text contains” filtering unlocks rapid insight into any text-heavy dataset, from customer notes to inventory SKUs. Whether you choose the modern FILTER function or fall back to classic methods, the ability to dynamically surface relevant rows is foundational to efficient analysis, compliance checks, and decision-making. Practice the techniques above, explore LET and helper columns for readability, and you’ll be able to weave this skill seamlessly into larger Excel solutions such as dashboards, pivot tables, and Power BI integrations. Keep experimenting with real data to cement your understanding and discover creative variations that fit your unique workflow.
Related Articles
How to Show the 10 Most Common Text Values in Excel
Learn multiple Excel methods to list the 10 most frequent text values—complete with step-by-step examples, business use cases, and expert tips.
How to Abbreviate Names Or Words in Excel
Learn multiple Excel methods to abbreviate names or words with step-by-step examples and practical applications.
How to Abbreviate State Names in Excel
Learn multiple Excel methods to abbreviate state names with step-by-step examples, professional tips, and real-world applications.