WPS Spreadsheet: Count Exact A and P Letters Without Counting Initials
Question details
The user needs to count cells whose complete values are exactly A or P, without counting those letters when they appear inside longer values.
- Product
- WPS Spreadsheets
- Device & OS
- not provided
- Scenario
- A row contains shift or attendance codes such as A, P, AB, or PA, and the user wants separate counts for exact A and P entries.
- Observed behavior
- LEN or wildcard-based counting can include letters inside longer cell values, producing inflated results.
Confirm the cells use consistent codes and identify the range to check, such as A1:Z1. Remove unintended leading or trailing spaces if exact entries are not being recognized.
Use COUNTIF with an exact letter criterion
Use this method when each target cell must contain only A or only P, with longer values such as AB and PA excluded.
COUNTIF compares each cell with the complete criterion when the criterion contains no wildcard characters. Therefore, "A" matches only a cell whose value is A, not a cell containing A as part of another value.
In WPS Spreadsheets, click the cell where you want to display the count for the A entries.
Type =COUNTIF(A1:Z1,"A") in the formula bar or directly in the cell, then press Enter. Replace A1:Z1 with your actual range.
In another result cell, enter =COUNTIF(A1:Z1,"P") and press Enter to count cells containing only P.
Review the source range to confirm that values such as AB, PA, or other names are not included in either count.
Use a case-sensitive exact-match formula when capitalization matters
Use this alternative when lowercase a and p must be excluded and the count must distinguish uppercase letters exactly.
Count Exact Shift Letters Quickly in WPS Spreadsheets
WPS Spreadsheets lets you use COUNTIF to count complete cell values such as A or P, excluding longer codes and initials. Its familiar formula tools make the workbook easy to update and share.
- 1. Open the spreadsheet: Launch WPS Office and open the workbook in WPS Spreadsheets.
- 2. Choose a result cell: Click an empty cell beside the source range where you want the exact A count to appear.
- 3. Enter the A formula: Type =COUNTIF(A1:Z1,"A") and press Enter, changing the range to match your data.
- 4. Enter the P formula: In a second empty cell, type =COUNTIF(A1:Z1,"P") and press Enter.

Frequently Asked Questions
Why does COUNTIF with "A" exclude values such as AB?
The criterion "A" requires the complete cell value to equal A. Because no wildcard is used, COUNTIF does not match AB, PA, or other longer values.
What formula counts exact P entries in a row?
Use =COUNTIF(A1:Z1,"P") in WPS Spreadsheets. Replace A1:Z1 with the range that contains your shift or attendance codes.
Does COUNTIF distinguish uppercase A from lowercase a?
No. COUNTIF is generally case-insensitive. To count uppercase A only, use =SUMPRODUCT(--EXACT(A1:Z1,"A")); use the equivalent formula with P for uppercase P.
Why is an exact letter not being counted?
Check for leading or trailing spaces, hidden characters, or different capitalization. Clean the cell contents or use the case-sensitive EXACT formula when capitalization is important.




