The asterisk wildcard matches any sequence of characters, including zero characters (an empty string). Placing an asterisk at the end of the criteria — "PRD-*" — anchors the match to the start, counting only cells that begin with PRD-. Placing an asterisk at the beginning — "*.com" — anchors the match to the end, counting only cells that end with .com. Asterisks on both sides match the text anywhere, which is the substring-match pattern used by the
count cells containing specific text formula. The question mark wildcard matches exactly one character, which is useful for structured data like postal codes or product IDs with a known format. You can combine asterisks and question marks in the same pattern — "AB??-*" matches any code starting with AB, then exactly two characters, then a hyphen, then anything. All wildcard matching in COUNTIF is case-insensitive, and both wildcards work the same way in the
COUNTIF function and the
COUNTIFS function. If your data genuinely contains an asterisk or question mark that you want to match literally, prefix it with a tilde: "~*" matches a real asterisk character.