How to Count Specific Attendance Values Instead of Summing Them
Question details
The user needs to count the number of times a specific numeric value appears in an attendance range, treating each occurrence as a single instance rather than summing the numbers together mathematically.

- Product
- Spreadsheet
- Device & OS
- not provided
- Scenario
- Calculating total attended weeks in a spreadsheet where a numeric code (like '2') represents a week of attendance.
- Observed behavior
- Instead of adding the values and calculating '2' as two weeks, the spreadsheet should count every cell containing the value '2' as exactly one attended week.
Ensure your attendance tracking sheet is organized with clear rows or columns for each individual, and verify that the numeric code you want to count is consistently formatted throughout the data range.
Use the COUNTIF Function to Count Occurrences
Use the COUNTIF formula to search your data range and count only the cells that match your specific attendance code, avoiding accidental mathematical summation.
When dealing with numeric codes in spreadsheets, standard functions like SUM will mathematically add the digits together. To evaluate a numeric code merely as an indicator of presence, COUNTIF is the correct tool.
Click on the empty cell at the end of your attendance row where you want the final count to be displayed.
Type the formula =COUNTIF(B2:K2, 2) into the formula bar. Replace 'B2:K2' with the actual range of your attendance data, and replace '2' with the numeric code you use to mark attendance.
Press the Enter key. The spreadsheet will now output the total number of times the value appears, treating each instance as exactly one attended week.

Display the Attendance as a Fraction of Total Weeks
Combine the COUNTIF function with the COLUMNS function to present the attendance data as a readable fraction, such as showing '8/10' attended weeks.
Track Attendance Effectively with WPS Spreadsheet
Easily manage rosters, calculate attendance fractions, and process complex counting criteria with WPS Spreadsheet. It offers a fully-featured formula library that makes data management intuitive and error-free.
- 1. Open your attendance sheet: Launch WPS Spreadsheet and open your existing attendance workbook.
- 2. Select the formula cell: Click the cell designated for the final total and type '=COUNTIF('.
- 3. Drag to select range: Highlight your data row with your mouse, add your criteria (e.g., ', 2)'), and press Enter to instantly see the result.

Frequently Asked Questions
Why does my spreadsheet add the values instead of counting them?
If your spreadsheet is adding the values together (for example, showing 4 when you have two cells containing 2), you are likely using the SUM function or AutoSum tool. To count how many times a value appears instead of calculating its mathematical sum, you must use the COUNTIF function.
Can I count cells that contain letters instead of numbers?
Yes. If your attendance tracker uses letters like 'P' for Present or 'A' for Absent, you can use the same COUNTIF function. Just ensure you enclose the text in double quotes within the formula, like this: =COUNTIF(B2:K2, "P").
How can I count multiple different attendance codes at the same time?
If you use multiple codes (e.g., 1 for half-day and 2 for full-day) and want to count the occurrences of both, you can add two COUNTIF formulas together. For example: =COUNTIF(B2:K2, 1) + COUNTIF(B2:K2, 2).




