WPS Spreadsheet: Count Day and Night Shifts in an Employee Schedule
Question details
The user needs to count day and night shift assignments in an employee schedule and determine how many employees are scheduled or still required.

- Product
- WPS Spreadsheet
- Device & OS
- not provided
- Scenario
- An employee schedule contains shift codes such as A and P, additional codes such as RO, PO, PE, and EDO, and possible overnight or split shifts.
- Observed behavior
- The schedule does not use a fully consistent coding pattern, so direct COUNTIF totals may misclassify non-working days, overnight shifts, or partial shifts.
Review the schedule and create a code key that defines A, P, RO, PO, PE, EDO, overnight shifts, and split shifts. Decide whether split shifts count as one employee, fractional coverage, or separate shift segments before writing formulas.
Standardize shift codes and count day and night assignments
Use this method when each schedule cell contains a consistent code such as A for day and P for night.
COUNTIF counts cells that exactly match a specified code. Non-shift codes should be excluded or counted separately according to the staffing rules for the schedule.
Replace B2:B20 with the actual range containing the employee assignments, and copy the formulas across other schedule columns when needed.
In WPS Spreadsheet, review the schedule range and record what each code means. Decide whether RO, PO, PE, and EDO are excluded from shift totals or counted in a separate category.
Select an empty result cell and choose Formulas > Insert Function, or enter =COUNTIF(B2:B20,"A") to count day-shift assignments in B2:B20.
In another result cell, enter =COUNTIF(B2:B20,"P") to count night-shift assignments in the same schedule range.
If the required staffing target is in E2, enter =MAX(0,E2-COUNTIF(B2:B20,"A")-COUNTIF(B2:B20,"P")) to calculate the remaining employees after counting both shift types.
Handle overnight and split shifts with a separate coverage rule
Use this method when an overnight assignment or two partial assignments should not be treated as a standard full shift.
Build reliable shift-counting formulas in WPS Spreadsheet
WPS Spreadsheet provides COUNTIF, SUM, MAX, and helper columns for organizing employee shift codes, counting day and night assignments, and calculating remaining staffing coverage in a familiar spreadsheet layout.
- 1. Open the schedule: Launch WPS Office, choose Spreadsheet, and open the employee schedule file from the Open tab.
- 2. Create a code key: Use an empty area of the worksheet to document A, P, RO, PO, PE, EDO, overnight, and split-shift rules.
- 3. Enter count formulas: Select result cells and enter COUNTIF formulas such as =COUNTIF(B2:B20,"A") and =COUNTIF(B2:B20,"P").
- 4. Calculate staffing gaps: Use MAX with the staffing target, such as =MAX(0,E2-day_count-night_count), to prevent negative required-employee totals.

Frequently Asked Questions
How do I count day shifts coded as A in WPS Spreadsheet?
Select an empty cell and enter =COUNTIF(B2:B20,"A"), changing B2:B20 to the range that contains the schedule assignments.
How can I count night shifts coded as P?
Enter =COUNTIF(B2:B20,"P") in a result cell. The formula counts only cells whose contents exactly match P.
Should RO, PO, PE, and EDO be included in the employee total?
Only include them if your staffing policy defines them as working coverage. Otherwise, count them separately with formulas such as =COUNTIF(B2:B20,"RO") and exclude them from the A and P staffing totals.
How should a split shift be counted?
First decide whether the split shift represents one employee, two shift segments, or fractional coverage. For fractional coverage, place values such as 0.5 in a helper column and use SUM instead of counting the schedule cell as a full shift.
What should I do when an overnight entry has no A or P code?
Review the time range and assign a standard code according to your schedule rules before counting it. If the entry crosses midnight or represents partial coverage, record its approved coverage value in a helper column.




