How to Use the COUNTIF function with Wildcards in Excel -7 Methods

This is an overview.

Excel COUNTIF Wildcard

The sample dataset has 8 rows and 2 columns. All cells are in General format. 

Dataset Overview


Method 1 – Use the COUNTIF function with a Wildcard to Count Text Values in Excel

Steps:

  • Select C13.
  • Enter the formula below.
=COUNTIF(B5:B11,"*")
  • Press Enter to see the result.


Method 2 – Using the COUNTIF with a Wildcard to count Numeric Values Only in Excel

Steps:

  • Enter the formula in C13.
=COUNTIF(B5:B11,"<>*")
  • Press Enter to see the result.

COUNTIF with Wildcard to Specify Numeric Values Only in Excel


Method 3 – Inserting the COUNTIF “Starts with” Wildcard in Excel

To count the cells in which the values start with “GHY”:

Steps:

  • Enter the formula in C13.
=COUNTIF(B5:B11,"GHY*")
  • Press Enter to see the result.

COUNTIF “Starts with” Wildcard in Excel


Method 4 – Applying the COUNTIF “Ends with” Wildcard in Excel

To count the cells that end with the characters “GH”:

Steps:

  • Enter the formula in C13.
=COUNTIF(B5:B11,"*GH")
  • Press Enter to see the result.


Method 5 – Using the COUNTIF “Contains” Wildcard in Excel

To count the cells that contain the value “256124FK”:

Steps:

  • Enter the formula in C13.
=COUNTIF(B5:B11,"*256124FK*")
  • Press Enter to see the result.

COUNTIF “Contains” Wildcard in Excel


Method 6 – Applying the COUNTIF “?” Wildcard in Excel

“HJI???GH” will search for values that start with HJI and end with GH.

Steps:

  • Enter the formula in C13.
=COUNTIF(B5:B11,"*HJI???GH")
  • Press Enter to see the result.

COUNTIF “?” Wildcard in Excel


Method 7 – Inserting the COUNTIF “~ (tilde)” Character Wildcard in Excel

*~?*” will find values containing a question mark.

Steps:

  • Enter the formula in C13.
=COUNTIF(B5:B11,"*~?*")
  • Press Enter to see the result.

Read More: INDEX MATCH Multiple Criteria with Wildcard in Excel


Download Practice Workbook

Download the free Excel template here and practice.


Further Readings

Get FREE Advanced Excel Exercises with Solutions!
Md. Sourov Hossain Mithun
Md. Sourov Hossain Mithun

Md. Sourov Hossain Mithun, an Excel and VBA Content Developer at Softeko's ExcelDemy project, joined in October 2021. Holding a Naval Architecture & Marine Engineering degree from BUET, Mithun showcases expertise during his two-year tenure. With over 200 published articles on Excel topics, he earned a promotion to Team Leader, excelling in leading diverse teams. Mithun's passion extends to Advanced Excel, Excel VBA, Data Analysis, and Python programming, contributing significantly to the innovative and dynamic environment of ExcelDemy... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo