Function Problems

Count Excel Cells That Begin with a Literal Asterisk Using COUNTIF

Muhammad TalhaMuhammad Talha Nov 18, 2026 871 views

Question details

Count cells whose text begins with a literal asterisk using COUNTIF.

Count Excel Cells That Begin with a Literal Asterisk Using COUNTIF
Product
Microsoft Excel
Device & OS
not provided
Scenario
A worksheet uses an asterisk at the beginning of some names as a category marker.
Observed behavior
A criterion such as "*Jones" treats the asterisk as a wildcard and matches values ending in Jones, even if they do not begin with a literal asterisk.
Before you start

Identify the range containing the names and check whether you need to count every value starting with an asterisk or only an exact value such as *Jones.

Solution 1Recommended

Escape the Asterisk in the Excel COUNTIF Criterion

Use a tilde before the asterisk to count it as a literal character rather than a wildcard.

1
Select a result cell

In Excel, click an empty cell where you want the count to appear.

2
Count all leading asterisks

Enter =COUNTIF(A2:A100,"~**") and press Enter. Replace A2:A100 with your data range. The first asterisk is escaped by ~; the second matches any following text.

3
Count a specific value instead

To count cells containing exactly *Jones, enter =COUNTIF(A2:A100,"~*Jones") in the result cell and press Enter.

Escape the Asterisk in the Excel COUNTIF Criterion
Why escaping matters: Without the tilde, * matches any number of characters, including none. For example, "*Jones" also matches Jones and The Jones.
WPS Spreadsheets

Count Literal Asterisks in WPS Spreadsheets

Use the same escaped COUNTIF criteria in WPS Spreadsheets to count text that starts with an asterisk or matches a specific marked name.

  1. 1. Open the spreadsheet: Open WPS Spreadsheets, select Open, and choose your workbook.
  2. 2. Select an empty cell: Click the cell where you want to display the count.
  3. 3. Enter the formula: Type =COUNTIF(A2:A100,"~**") to count cells starting with a literal asterisk, replacing the range with your own.
  4. 4. Calculate the result: Press Enter to display the count. For an exact match such as *Jones, use =COUNTIF(A2:A100,"~*Jones") instead.
Count literal asterisk markers with COUNTIFOpen and edit Microsoft Excel XLSX filesUse a familiar spreadsheet interface
microsoft office alternative - wps office

Frequently Asked Questions

Why does COUNTIF count Jones when I use "*Jones"?

In a COUNTIF criterion, * matches any number of characters, including zero. Use "~*Jones" to match the literal text *Jones.

How do I count every cell that starts with an asterisk?

Enter =COUNTIF(A2:A100,"~**") in an empty cell, replacing A2:A100 with your range. The tilde makes the first asterisk literal, while the second matches any following text.

Can I use a different character as a category marker?

Yes. If you can choose the marker, consider | or ! instead. Avoid ? because it is also a COUNTIF wildcard, and be cautious with leading =, +, or -, which may be interpreted as formula operators.

Will the escaped COUNTIF formula work in WPS Spreadsheets?

Yes. Open the workbook in WPS Spreadsheets and enter a formula such as =COUNTIF(A2:A100,"~*Jones") in an empty cell.