Table of Contents
The Excel Advanced Filter feature is a highly sophisticated tool that vastly surpasses the capabilities of the standard AutoFilter. It enables users to implement the “Contains” operation, which is critical for creating a custom filter capable of searching for a specific text string within a designated range of cells. This powerful functionality allows analysts to efficiently isolate records containing the target string, or conversely, to easily identify and manage (e.g., delete or move) rows based on the presence of specific textual content. To initiate the “Contains” function, one must first clearly define the data range to be processed, navigate to the Data tab, select the Advanced Filter option, choose the “Filter the list, in-place” action, and then, most importantly, define the criteria using appropriate wildcards to achieve the desired “Contains” logic.
The Advanced Filter mechanism in Excel relies on the strategic use of wildcards to perform advanced pattern matching, including the “Contains” functionality. When specifying criteria to filter rows that contain specific text, the asterisk (*) wildcard acts as a placeholder for any sequence of characters—or no characters at all—on either side of the target string. This flexible approach is what allows the filter to look for a partial match rather than an exact match, which is essential for text parsing and categorization tasks within large datasets.
*sometext*
The syntax shown above is the key to unlocking the “Contains” filtering capability. By surrounding the desired text string (e.g., “sometext”) with asterisks, we instruct the Excel Advanced Filter to return any row where the corresponding cell in the filtered column includes that text, regardless of what precedes or follows it. Mastering this simple structure enables highly targeted data extraction. We will explore two primary applications of this syntax through practical scenarios, demonstrating its versatility in real-world data analysis.
Filter for rows that contain one specific text string, utilizing a single criterion for focused results.
Filter for rows that contain one of multiple text strings, employing OR logic to broaden the scope of the search.
Understanding the Power of the Excel Advanced Filter
The Advanced Filter is often underutilized, yet it represents a significant upgrade over the standard AutoFilter dropdown menu, especially when dealing with complex logical requirements. Unlike AutoFilter, which limits criteria setup to the column headers themselves, the Advanced Filter uses a dedicated external range, known as the criteria range. This separate area allows for the implementation of complex AND/OR logic, numerical comparisons, and formula-based criteria, providing unparalleled control over the filtering process.
In the context of text manipulation, the Advanced Filter excels because it seamlessly integrates the use of wildcards. Standard filters often require cumbersome manual selections or complex string functions to achieve partial text matching. By contrast, the Advanced Filter’s reliance on the criteria range simplifies these operations into a clear, visual setup. This method not only enhances efficiency but also makes the filtering logic transparent and easily auditable by other users working with the same spreadsheet.
Before proceeding with any filtering operation, it is paramount to ensure your source data is properly structured. The data must be arranged in a contiguous block, typically with a single row of unique column headers at the top. This structure facilitates accurate identification of the List Range and ensures that the Advanced Filter correctly maps the criteria specified in the criteria range to the corresponding fields in your main dataset. Failure to adhere to these basic data hygiene rules can lead to incorrect or incomplete filtering results.
The Essential Role of Wildcards in “Contains” Filtering
The asterisk (*) and the question mark (?) are the two primary wildcards used in Excel for text matching. While the question mark represents any single character, the asterisk is significantly more powerful for “Contains” operations, as it represents any sequence of zero or more characters. This flexibility is what defines the “Contains” behavior we are seeking: locating the specified text string anywhere within the cell content.
When we input a criteria like *North*, we are instructing the filter to find cells that begin with anything (or nothing), followed by the exact sequence “North”, followed by anything (or nothing). This setup is fundamentally different from entering North*, which would only find cells that begin with “North,” or *North, which would only find cells that end with “North.” The surrounding asterisks ensure that the match is truly partial and position-independent within the cell.
It is important to note that the text matching performed by the Advanced Filter is typically case-insensitive by default, meaning that searching for “*st*” will yield results containing “St”, “ST”, or “st”. If a case-sensitive search is required, the criteria must be defined using a complex formula within the criteria range, utilizing functions like EXACT, which bypasses the standard wildcard interpretation but adds significant complexity to the setup.
Setting Up the Criteria Range for Advanced Filtering
The preparation of the criteria range is the most crucial step in utilizing the Advanced Filter. This range must contain at least two rows. The first row must consist of headers that exactly match the headers in your primary data list—spelling, capitalization, and spacing must be identical. The subsequent rows are where the actual filtering conditions are placed.
For a basic “Contains” operation involving a single column, you only need to copy the header of that column (e.g., “Region”) into the criteria range. Directly beneath this header, in the second row, you input the wildcard expression, such as *West*. This arrangement tells Excel: “Filter the data where the column named ‘Region’ contains the text ‘West’.”
When setting up the criteria, ensure that the criteria range is placed in an empty area of your worksheet, safely away from the main dataset, to prevent accidental inclusion or corruption of the criteria. Proper spacing and header matching are non-negotiable prerequisites for the filter to execute successfully and return the expected results based on your defined “Contains” logic.
You can use the following syntax to filter for rows that contain specific text in an Excel Advanced Filter:
*sometext*
The following examples show how to use this function in two different scenarios:
Filter for rows that contain one specific text
Filter for rows that contain one of multiple text
Example 1: Filtering for Rows that Contain One Specific Text String
To demonstrate the utility of the “Contains” operator, let us consider a typical corporate dataset detailing sales figures. Suppose we have the following data structure, which comprehensively tracks product sales volumes across various geographical regions for a company over a specific period. This scenario requires us to quickly isolate all transactions that occurred in regions whose names share a particular substring.

For this specific exercise, the requirement is to filter the entire dataset to exclusively show rows where the value in the “Region” column contains the substring “st“. This requirement could stem from the need to analyze performance across regions like ‘East’ and ‘West’ simultaneously, without having to manually select multiple distinct region names.
To achieve this precise filtering result, we must first establish the appropriate criteria range. This involves replicating the column header “Region” and, directly below it, inputting the wildcard expression that encapsulates the desired string. The use of asterisks ensures that the presence of “st” anywhere within the region name, regardless of position, will trigger a match, thereby satisfying the “Contains” logic.

Step-by-Step Procedure for Single Criteria Filtering
Once the source data and the criteria range are properly established, the actual application of the Advanced Filter is straightforward. The entire process begins by ensuring that any cell within the data range (A1:C17) is currently selected. This contextual selection helps Excel automatically identify the boundaries of the List Range.
The next procedural step requires navigating to the main menu ribbon. Click the Data tab, which houses all data management tools, and then locate and click the Advanced Filter button, usually found within the “Sort & Filter” group. This action opens the “Advanced Filter” dialog box, prompting the user to define the parameters of the operation.

Within the dialog box, we must confirm two essential ranges. First, specify A1:C17 as the List range—this encompasses all the header rows and data rows of the primary sales table. Second, define F1:F2 as the Criteria range, which contains the ‘Region’ header and the wildcard expression “*st*“. Additionally, ensure that the action selected is “Filter the list, in-place” if the filtered results are intended to overwrite the view of the original data.

Upon clicking OK, the Advanced Filter executes the operation instantaneously. The dataset is then dynamically filtered, retaining only those rows where the “Region” column meets the criterion—that is, containing the text “st“. This powerful display instantly highlights the targeted data, allowing for immediate analysis of sales performance in regions like ‘East’ and ‘West’, while concealing irrelevant data points.

Example 2: Filtering for Rows that Contain One of Multiple Text Strings
While Example 1 demonstrated the use of a single “Contains” criterion, the true strength of the Advanced Filter lies in its ability to handle complex logical combinations, specifically the OR condition. We return to the initial sales dataset, which remains the foundation for our analysis, maintaining the original structure of Product, Region, and Sales columns.

For this advanced scenario, the objective is to filter the data for rows where the Region contains the substring “st” OR the Region contains the substring “Nor.” This might be necessary, for example, if we need to combine sales reporting for all regions categorized as ‘East’/’West’ along with all ‘North’ regions, ignoring all ‘South’ or ‘Central’ transactions.
To implement the OR logic, we require a fundamental change in how the criteria range is constructed. Instead of placing all conditions horizontally (which implies an AND relationship), OR conditions must be placed vertically, spanning multiple rows beneath the header. Each row represents an independent condition that, if met, will cause the entire row of data to be included in the filtered results.

Interpreting OR Logic in the Advanced Filter Criteria
The revised criteria range (F1:F3 in the visual example) explicitly defines the OR relationship. The header, “Region,” is listed once in F1. The first criterion, “*st*“, is placed directly under the header in F2. The second criterion, “*Nor*“, is placed in the row immediately below that, in F3. The vertical arrangement of these criteria is the mechanism by which Excel interprets the request as an OR operation: find records matching F2 OR records matching F3.
If we had mistakenly placed “*st*” in F2 and “*Nor*” in G2 (under a different header), Excel would interpret this as an AND condition across columns. However, since both wildcards expressions are listed vertically under the same column header (“Region”), the condition is applied to that column sequentially, guaranteeing the desired OR logic for the “Contains” requirement.
After defining the expanded criteria range, the steps to apply the Advanced Filter remain consistent. Click the Data tab, then the Advanced Filter button. The List Range (A1:C17) remains unchanged, but the Criteria Range must now be updated to encompass all rows used for the criteria: F1:G3, as shown in the dialog box configuration.
Next, we can click the Data tab and then click the Advanced Filter button.
We’ll choose A1:C17 as the list range and F1:G3 as the criteria range:

Once we click OK, the dataset will be processed according to the compound OR condition. The resulting filtered view will display only rows where the Region column contains “st” (e.g., East, West) or contains “Nor” (e.g., North, Northeast). This successful execution confirms the ability of the Advanced Filter to handle sophisticated multi-criteria text matching using wildcards.

Best Practices and Limitations of Using Advanced Filter
While the Advanced Filter is incredibly potent, users must be mindful of best practices to ensure reliable results. Always use clearly defined, non-merging cells for the criteria range. If you intend to filter the data in place, ensure you have a backup of the original data, as the process temporarily hides rows rather than deleting them, which can sometimes lead to confusion if the filter is forgotten.
A significant limitation involves the interaction between the “Contains” operator and certain reserved characters. If you need to search for an actual asterisk (*) or question mark (?), you must precede it with the tilde symbol (~). For example, to search for the string “Sales*”, the criteria should be entered as *Sales~**. Ignoring this escape character rule will cause the filter to interpret the asterisk as a wildcard, leading to unexpected results.
Furthermore, when defining the criteria range for formula-based logic (which goes beyond simple “Contains” but is relevant for sophisticated filtering), remember that the criteria header must be left blank or contain a non-matching label. This specific requirement ensures Excel knows to evaluate the condition based on the formula’s output (TRUE/FALSE) rather than trying to match the formula text itself against the data values. Always double-check the List Range and Criteria Range boundaries before execution, especially when working with volatile or frequently changing datasets.
Cite this article
stats writer (2025). How to Easily Filter for Specific Text Using “Contains” in Excel Advanced Filter. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/how-to-use-contains-in-excel-advanced-filter/
stats writer. "How to Easily Filter for Specific Text Using “Contains” in Excel Advanced Filter." PSYCHOLOGICAL SCALES, 30 Nov. 2025, https://scales.arabpsychology.com/stats/how-to-use-contains-in-excel-advanced-filter/.
stats writer. "How to Easily Filter for Specific Text Using “Contains” in Excel Advanced Filter." PSYCHOLOGICAL SCALES, 2025. https://scales.arabpsychology.com/stats/how-to-use-contains-in-excel-advanced-filter/.
stats writer (2025) 'How to Easily Filter for Specific Text Using “Contains” in Excel Advanced Filter', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/how-to-use-contains-in-excel-advanced-filter/.
[1] stats writer, "How to Easily Filter for Specific Text Using “Contains” in Excel Advanced Filter," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, November, 2025.
stats writer. How to Easily Filter for Specific Text Using “Contains” in Excel Advanced Filter. PSYCHOLOGICAL SCALES. 2025;vol(issue):pages.
