Learning to Use “Contains” with Excel’s Advanced Filter


The Excel Advanced Filter stands out as an exceptionally robust mechanism for extracting specific subsets of data based on intricate rules. Far surpassing the capabilities of standard auto-filters, the Advanced Filter is essential when dealing with complex, multi-layered conditions or when the requirement is to filter based on patterns embedded within text strings—a common task in deep data analysis. This comprehensive tutorial focuses on harnessing the “contains” logic, a powerful technique that utilizes special characters to identify records where a cell holds a specific substring, irrespective of its position.

Implementing the “contains” functionality within the Advanced Filter requires employing wildcard characters. These characters are placeholders that represent unknown or variable elements within a search pattern. The cornerstone of text-based pattern matching in Excel is the asterisk (*), which serves as a substitute for any sequence of characters, including none at all. Understanding how to correctly structure this syntax is the key to unlocking highly flexible text filtering.

To instruct Excel to filter cells that contain a specific text string, regardless of what precedes or follows it, you must enclose the target text within asterisks. This establishes a universal search pattern that looks for the substring anywhere within the cell content.

*sometext*

The asterisk preceding sometext indicates that any characters may occupy that space, and the asterisk following it signifies that any characters may follow. This flexibility is what allows the “contains” filter to operate efficiently. Throughout the subsequent examples, we will demonstrate two crucial applications of this technique:

  • Filtering a dataset to isolate rows that match a single, specific text pattern (the “contains” function).
  • Filtering data using an OR logic approach, where rows are included if they contain any one of several defined text patterns.

Establishing the Foundation: Data and Criteria Setup

Before initiating any filtering operation, it is paramount to ensure your data is correctly structured for the Excel Advanced Filter. A prerequisite for accurate and reliable filtering is a well-organized dataset, which forms the basis of the list range, coupled with a meticulously defined set of conditions, referred to as the criteria range.

Your source data must conform to the principles of structured data: a clear header row identifying each attribute (e.g., Product ID, Region, Sales Total) followed by consistent data entries. A non-negotiable requirement for the Advanced Filter is the exact match between the column headers in your list range and the headers utilized in your criteria range. This strict matching ensures that Excel directs the filtering conditions to the correct columns; even minor spelling errors or extra spaces will cause the filter to fail.

The criteria range must be established in a separate, dedicated area of the worksheet. It must include the header row (copied precisely from the list range) and at least one row beneath it dedicated to the actual criteria. For implementing the “contains” logic, you will place the appropriate wildcard pattern—such as *sometext*—directly beneath the specific column header you intend to filter, setting the stage for the targeted data extraction.

Example 1: Filtering for a Single Contained Text String

To illustrate the practical application of the “contains” filter, consider a scenario involving a sales tracking dataset. This dataset includes key information such as product categorization, regional assignment, and corresponding sales figures. Our primary goal is to refine this dataset to display only those rows where a specific column, “Region,” includes a designated text substring.

We will use the following sample sales dataset for our demonstration, which is representative of typical business data structures:

For this specific exercise, let’s assume we need to isolate all records where the “Region” designation contains the characters “st“. This functionality is incredibly useful for analysts who need to swiftly group regions like “East” and “West” for comparative performance reviews or targeted reporting, based simply on a shared sequence of characters.

The execution begins by carefully constructing the criteria range. It must feature the exact header “Region” copied from the dataset. Directly beneath this header, we enter the wildcard pattern that captures the required condition: *st*. This pattern mandates that the filter only returns rows where “st” exists somewhere in the cell contents.

Our criteria range setup is visually represented here:

With the criteria range correctly configured, navigate to the Data tab on the Excel ribbon. Within the “Sort & Filter” group, select the Advanced Filter button. This action launches the configuration dialog box, where you define the specific parameters for the filtering operation.

Within the Advanced Filter dialog box, two ranges must be specified precisely. First, the list range must encompass the entire dataset, including all headers (A1:C17). Second, the criteria range must strictly include the “Region” header and the *st* criterion (F1:F2). Ensure the action selected is “Filter the list, in-place” unless you intend to copy the results elsewhere.

Once you confirm the settings by clicking OK, Excel immediately applies the criteria. The resulting dataset dynamically adjusts, displaying only those sales records where the “Region” column successfully contains the characters “st“. This focused output facilitates immediate, targeted data analysis.

Example 2: Implementing OR Logic with Multiple Contained Text Strings

One of the most valuable features of the Excel Advanced Filter is its capacity to handle complex logical operations, notably the OR logic. This powerful mechanism allows data extraction based on multiple, alternative criteria, meaning a row is included if it satisfies any one of the specified conditions. We will use our existing sales dataset to demonstrate how to filter for rows that contain one of two distinct text strings within the “Region” column.

Let us consider the standard sales dataset again, which serves as our source data:

Our revised objective is to filter the data such that the “Region” column contains either the substring “st” (capturing East/West) or the substring “Nor” (capturing North/Northern). This combined criterion allows for a consolidated view of sales across several geographically related regions simultaneously, offering a broader and more efficient analysis.

To correctly implement this “OR” condition, the structure of the criteria range is crucial. Unlike “AND” conditions, which are placed on the same row, criteria linked by “OR” logic must be placed on separate rows beneath the relevant column header. By placing *st* on the first criteria row and *Nor* on the second criteria row, we instruct Excel to include a record if it matches the first condition OR the second condition.

The updated criteria range, designed to capture regions containing “st” or “Nor“, must be expanded to accommodate the additional row, appearing as follows:

Once the criteria range is finalized, navigate once more to the Data tab and initiate the Advanced Filter dialog box. Configure the settings by selecting A1:C17 as the list range, covering the entire source dataset. Critically, the criteria range must now be selected as the expanded area F1:G3, which includes the header and both criteria rows.

Upon clicking OK, Excel executes the complex filter. The resulting dataset will display all rows where the “Region” column contains either “st” or “Nor“. This demonstrates the inherent power of the Advanced Filter to manage intricate logic for nuanced data extraction.

Best Practices and Troubleshooting for Advanced Filtering

To ensure the reliable performance and accuracy of the Excel Advanced Filter, adopting a set of best practices is essential. The most fundamental rule involves absolute consistency in header naming. The headers in your criteria range must be identical—down to the capitalization and spacing—to the headers in your list range. Mismatched headers are the most frequent cause of filter failure, resulting in either a corrupted list or a filter that returns no results.

Another crucial best practice is the strategic placement of your criteria range. Always position it in an isolated, blank area of the worksheet, separate from the primary dataset. This separation prevents the accidental inclusion of criteria rows when defining the list range and contributes significantly to workbook clarity and maintainability. When designing complex criteria, remember the rule of logical precedence: conditions placed horizontally across the same row are treated as AND logic (requiring all conditions to be met), while conditions placed vertically on different rows under the same header constitute OR logic (requiring only one condition to be met).

If the Advanced Filter does not yield the anticipated results, systematically review the configuration steps. Verify that the range selections in the dialog box—both the list and criteria ranges—are correct. If issues persist, check for hidden columns, blank rows, or inadvertent spaces in the criteria entries, particularly around the wildcard characters. For advanced filtering workflows or when preservation of the original data is essential, leverage the “Copy to another location” feature. This powerful option extracts the filtered results to a new, specified range or even a separate sheet, leaving the source data intact for subsequent operations or archival purposes.

Conclusion and Further Exploration

The Excel Advanced Filter, particularly when combined with effective use of wildcards, provides a highly versatile and professional solution for extracting targeted data analysis from comprehensive datasets. By mastering the simple yet flexible *sometext* syntax, users can dramatically enhance their data manipulation efficiency, swiftly identifying and isolating rows based on contained text strings, whether the criteria is singular or combined via OR logic.

This guide has provided detailed, practical steps on setting up and executing the “contains” feature for both single and multiple criteria applications within the Advanced Filter environment. The ability to define precise, pattern-based criteria using wildcards is an indispensable skill, greatly benefiting any professional engaged in detailed data examination and reporting in Excel.

We encourage you to expand upon these foundational techniques by exploring the Advanced Filter’s other sophisticated features. You can delve into filtering based on complex numerical comparisons, date ranges, or even advanced computed criteria that utilize formulas to generate conditional filtering rules. Continued exploration of these advanced functionalities will unlock deeper insights and greater control over your data management processes.

Additional Resources for Data Mastery

To further refine your expertise in Excel and data manipulation, we recommend studying the following related topics:

  • Explore techniques for filtering data to identify unique values or efficiently remove duplicate entries from large lists.
  • Learn how to apply the Advanced Filter effectively using numerical conditions, such as specifying records “greater than” or “less than” a certain threshold.
  • Discover the methodology for using formulas as criteria within the Advanced Filter for highly customized and dynamic filtering needs.
  • Understand the architectural differences and the optimal use cases that distinguish basic auto-filters from the more powerful Advanced Filter functionality.

Cite this article

Mohammed looti (2025). Learning to Use “Contains” with Excel’s Advanced Filter. PSYCHOLOGICAL STATISTICS. Retrieved from https://statistics.arabpsychology.com/excel-advanced-filter-use-contains/

Mohammed looti. "Learning to Use “Contains” with Excel’s Advanced Filter." PSYCHOLOGICAL STATISTICS, 31 Oct. 2025, https://statistics.arabpsychology.com/excel-advanced-filter-use-contains/.

Mohammed looti. "Learning to Use “Contains” with Excel’s Advanced Filter." PSYCHOLOGICAL STATISTICS, 2025. https://statistics.arabpsychology.com/excel-advanced-filter-use-contains/.

Mohammed looti (2025) 'Learning to Use “Contains” with Excel’s Advanced Filter', PSYCHOLOGICAL STATISTICS. Available at: https://statistics.arabpsychology.com/excel-advanced-filter-use-contains/.

[1] Mohammed looti, "Learning to Use “Contains” with Excel’s Advanced Filter," PSYCHOLOGICAL STATISTICS, vol. X, no. Y, ص Z-Z, October, 2025.

Mohammed looti. Learning to Use “Contains” with Excel’s Advanced Filter. PSYCHOLOGICAL STATISTICS. 2025;vol(issue):pages.

Download Post (.PDF)
Scroll to Top