Quantcast
Channel: Active questions tagged worksheet-function - Super User
Viewing all articles
Browse latest Browse all 987

How to count the number of cells that contain certain text while excluding cells that start the same but end different

$
0
0

In our company, the truck numbers in our database all start with "TK" A regular truck would be "TK123" for example. We also have stipend trucks and these all start with "TKPB" meaning their truck numbers would go "TKPB123".

I am trying to count the number of regular trucks (TK) I have every week but I don't want to count the stipend trucks (TKPB). I'm using a pivot table and have created a column that counts the trucks using this formula: =COUNTIF([@[Unit '#]],"TK*").This returns a 1 or a 0. From there, I have my pivot table summing that column. This almost works but it's counting the TKPB trucks as well because they start with TK instead of returning a 0.

How would you tell Excel to count only cells starting with TK followed by a number and not any TKPB cells?

Thank you,Cole

Picture of my excel sheet


Viewing all articles
Browse latest Browse all 987

Trending Articles