Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Google Sheet: How to count cells containing "P-" but not in "AP-"

My spreadsheet has different types of grading. My goal is to count each type using Count If formula. Counting "AC-", I used =countif(B:B5,"*AC-*") and the count is correctly showing 1. However, counting "P-", the formula =countif(B:B5,"*P-*") is showing 3 because of results from "P-Redo", "AP-Superb", "P-Poor". I am trying to create a formula to count only "P-" and ignore "AP-Superb". Thanks.

Name Type
Kevin AC-Mediocre, P-Redo
Linda AB-Decent, AP-Superb
Jen P-Poor

Google Sheet Example Link

I have tried using regexmatch and used "^" to find the start of a string. =SUMPRODUCT(REGEXMATCH(B:B5, "(^)P-")) but my regexmatch formula is not correct.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You may try with this slight change in your current regex formula:

=SUMPRODUCT(REGEXMATCH(B$1:B$5,"\b"&A26))

enter image description here

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading