logo
search
Function Problems

How to Use Excel COUNTIFS with Wildcards for Multiple Text Strings

Maira MehtabMaira Mehtab Sep 27, 2026 871 views

Question details

The user needs to count cells in a spreadsheet that contain multiple specific partial text strings using a single formula with AND logic.

Product
Excel / WPS Spreadsheet
Device & OS
not provided
Scenario
Counting cells based on multiple partial text matches within a single range.
Observed behavior
The user wants an accurate formula to return the count of cells containing both specified text strings (e.g., 'this' and 'that') anywhere within the text.
Before you start

Ensure your text data is within a contiguous range and identify the exact partial strings you want to search for. Remember that the asterisk (*) wildcard represents any sequence of characters in formulas.

Solution 1Recommended

Use the COUNTIFS Function with Asterisk Wildcards

This method applies an AND logic across the same data range, ensuring that a cell is counted only if it contains all specified text strings.

The COUNTIFS function is designed to evaluate multiple criteria. By supplying the exact same cell range multiple times but with different wildcard criteria, you can force the function to count only the cells that contain all your required substrings.

The asterisk (*) is a powerful wildcard that matches any number of characters before, between, or after your target words. Wrapping your target word in asterisks (e.g., "*word*") ensures the formula finds the word regardless of its position in the cell.

1
Select a blank cell

Click on the cell where you want the final count result to appear.

2
Enter the COUNTIFS formula

Type =COUNTIFS(A1:A100, "*this*", A1:A100, "*that*") into the formula bar. Replace A1:A100 with your actual data range, and change 'this' and 'that' to your specific search terms.

3
Apply the formula

Press Enter. The cell will now evaluate the range and display the total number of cells that contain both text strings.

Case Insensitivity: The COUNTIFS function is not case-sensitive. It will count 'This', 'THIS', and 'this' equally as a valid match.
Powerful Spreadsheet Formulas

Use WPS Spreadsheet to Count Complex Text Matches

WPS Spreadsheet fully supports the COUNTIFS function and wildcard characters, making it easy to analyze complex text data and streamline your workflows efficiently.

  1. 1. Open your dataset in WPS: Launch WPS Office and open your workbook in the Spreadsheet application.
  2. 2. Insert the formula: Select a destination cell and input =COUNTIFS(A1:A100, "*word1*", A1:A100, "*word2*").
  3. 3. Get instant results: Press Enter to instantly count the cells matching your multiple wildcard conditions.
100% compatible with Microsoft Excel formulas like COUNTIFSFree and lightweight alternative for seamless data analysisBuilt-in formula hints and intelligent syntax guidesCross-platform support for Windows, Mac, iOS, and Android
microsoft office alternative - wps office

Frequently Asked Questions

Can I use OR logic with COUNTIFS instead of AND logic?

No, the COUNTIFS function inherently uses AND logic for its criteria. To count cells containing 'this' OR 'that', you should add two COUNTIF functions together: =COUNTIF(A1:A100,"*this*") + COUNTIF(A1:A100,"*that*"). Keep in mind you may need to subtract the cells that contain both so they aren't counted twice.

Does the order of the text strings matter in the wildcard search?

In the formula =COUNTIFS(range, "*this*", range, "*that*"), the order of 'this' and 'that' within the actual cell does not matter. The formula will count the cell whether its content is 'this and that' or 'that and this'.

Is there a way to make the wildcard search case-sensitive?

The COUNTIFS function is case-insensitive by default. If you need a case-sensitive count, you would need to use a more advanced array formula combining SUMPRODUCT, ISNUMBER, and FIND, because the FIND function is strictly case-sensitive.

What other wildcards can I use in formulas?

Besides the asterisk (*) which matches any sequence of characters, you can use the question mark (?) to match any single character. You can also use the tilde (~) to escape wildcards if you want to find an actual literal asterisk (~*) or question mark (~?).