Function Problems

How to Count Emails by Time Period with COUNTIFS in WPS Spreadsheets

Huda QurayshiHuda Qurayshi Nov 13, 2026 869 views

Question details

The user needs to count email records that fall within specific time periods when the timestamp column contains both date and time values in WPS Spreadsheets.

How to Count Emails by Time Period with COUNTIFS in WPS Spreadsheets
Product
WPS Spreadsheets
Device & OS
not provided
Scenario
The user has email data with timestamps and categories, and needs period-based counts by date or time boundary without double-counting or missing records.
Observed behavior
COUNTIF and COUNTIFS can return incorrect period counts when boundary dates include time values and the criteria are not set as an inclusive lower bound with an exclusive upper bound.
Before you start

Confirm that the timestamp column contains real Excel date-time values rather than text, and place period start values in one column with the next period start in the following row so it can serve as the exclusive upper bound.

Solution 1Recommended

Use COUNTIFS with Inclusive Start and Exclusive Next Period

Use this formula when email timestamps include dates and times and period ranges share boundaries; it prevents the last day from being omitted when times are present.

The formula counts a row when the timestamp is greater than or equal to the period start and less than the next period start. The less-than next boundary includes every time on the start date while excluding the next period, so no record is counted twice.

1
Check the data layout

Open the workbook in WPS Spreadsheets and locate the timestamp column C2:C10000, category column E2:E10000, period start cell G2, next period start cell G3, and category heading I1.

2
Select the result cell

Click the cell where you want the first count to appear, such as I2.

3
Enter the COUNTIFS formula

In the formula bar, type =COUNTIFS($C$2:$C$10000,">="&$G2,$C$2:$C$10000,"<"&$G3,$E$2:$E$10000,I$1) and press Enter.

4
Fill the formula across and down

Drag the fill handle from the selected cell across the category headings and down through the period rows to apply the formula to additional counts.

5
Verify the counts

Compare the returned counts with a few manually filtered rows to confirm that the start date is included and the next period start is excluded.

Use COUNTIFS with Inclusive Start and Exclusive Next Period
Correct period boundaries: Using "<"&$G3 as the upper bound includes all times on the start date and avoids omitting records after midnight or double-counting the next period.
Direct solution in WPS Spreadsheets

Count Email Records by Date-Time Periods in WPS Spreadsheets

Use the COUNTIFS function in WPS Spreadsheets to count email records between a period start and the next period start. The formula handles date-time timestamps cleanly, is free to use, and fully supports Excel workbook formats.

  1. 1. Open your workbook in WPS Spreadsheets: Launch WPS Office and open the Excel file containing the email timestamp and category data, or create a new WPS Spreadsheets workbook.
  2. 2. Identify your data ranges: Verify the timestamp column, category column, period start cell, next period start cell, and category heading used in the COUNTIFS formula.
  3. 3. Enter the COUNTIFS formula: Select the result cell, type the COUNTIFS formula with ">="&start and "<"&next period boundaries, and press Enter.
  4. 4. Fill and verify: Drag the fill handle across and down, then compare a few counts with filtered rows to confirm the results are accurate.
  5. 5. Save the workbook: Click the Save icon or go to Menu > Save As, choose the original Excel format such as .xlsx, and save the workbook.
Counts email records correctly when timestamps contain both dates and timesFull compatibility with Microsoft Excel COUNTIFS formulas and .xlsx workbooksFree, lightweight spreadsheet application with a familiar ribbon and formula barSeamless migration from Microsoft Excel without losing data or formulasSupports CSV and Excel formats for email timestamp imports
microsoft office alternative - wps office

Frequently Asked Questions

Why does COUNTIFS return the wrong count when email timestamps include times?

A common reason is using an upper bound such as "<="&end_date. If the end date contains times after midnight, rows later that day are excluded. Use the next period start with "<" as the upper bound to include the entire start date.

How do I check that my timestamp column contains real date-time values in WPS Spreadsheets?

Select the timestamp cells and check the Number Format on the Home tab; real date-time values show a date or custom date-time format. You can also use =ISNUMBER(C2) in an empty cell: if it returns TRUE, the cell is a numeric date-time; if FALSE, it is text and should be converted.

Can I count emails by both time period and category with COUNTIFS?

Yes. Add the category range and category heading as the third criteria pair. For example, with timestamps in C2:C10000, categories in E2:E10000, period start in G2, next period start in G3, and category heading in I1, use =COUNTIFS($C$2:$C$10000,">="&$G2,$C$2:$C$10000,"<"&$G3,$E$2:$E$10000,I$1).

How do I apply the COUNTIFS formula to multiple periods and categories?

Click the result cell and drag the fill handle across columns for categories and down rows for periods. The mixed cell references keep the timestamp and category ranges fixed while updating the period boundaries and category heading.

What is the difference between COUNTIF and COUNTIFS for date-time period counts?

COUNTIF handles only one condition, so it is limited to a single upper or lower boundary. COUNTIFS supports multiple conditions, letting you combine inclusive lower and exclusive upper boundaries with category filters in one formula.