The stock sheet has BOX-07, KIT-BOX-02, BOX-12 and BOXING-04. Count the codes that begin with BOX-, including its hyphen.

Put the wildcard after the prefix

With the four codes in A2:A5, use:

=COUNTIF(A2:A5,"BOX-*")

The result is 2. The wildcard covers the rest of the code. The match starts at the first character, so the embedded BOX- in KIT-BOX-02 does not qualify.

A sample list highlights BOX-07 and BOX-12 and leaves KIT-BOX-02 and BOXING-04 out.

Illustrated prefix test. Match the exact starting prefix including the hyphen.

Verify the count against examples

Check the first character and the hyphen in each included code. A leading space can change whether a code matches. If the prefix lives in D2, use =COUNTIF(A2:A5,D2&"*") after checking the prefix is filled. COUNTIF is case-insensitive, and the wildcard also matches an empty suffix.

A comparison shows the wildcard after BOX- and the result of two matching codes.

Illustrated formula check. Inspect the count with a small known list before using it on the full sheet.

Microsoft’s COUNTIF and related function reference.