Function Problems

Count Records by Month, Year, and Entity in Excel

Elise WilliamsElise Williams Nov 18, 2026 871 views

Question details

Count records that match a specified month, year, and entity.

Count Records by Month, Year, and Entity in Excel
Product
Excel or WPS Spreadsheets
Device & OS
not provided
Scenario
A user wants to count new hires for Entity Pluto in a selected month and year.
Observed behavior
The desired result is a count of rows whose entity and date match all the selected criteria.
Before you start

Check whether the values in the date column are real spreadsheet dates or text such as "July 2024". Identify the entity and date ranges, and make sure they cover the same rows.

Solution 1Recommended

Count matching records using real dates

Use date boundaries when the date column contains real spreadsheet dates, including dates with times.

1
Enter the criteria

Enter the target year in A5, the month number in B5, and the entity name in C8. For example, use 2024, 7, and Entity Pluto.

2
Enter the COUNTIFS formula

Select an empty result cell and enter =COUNTIFS('Employee Data'!$I$8:$I$18,$C8,'Employee Data'!$Q$8:$Q$18,">="&DATE($A$5,$B$5,1),'Employee Data'!$Q$8:$Q$18,"<"&EDATE(DATE($A$5,$B$5,1),1)).

3
Adjust the ranges

Replace 'Employee Data'!$I$8:$I$18 with your entity range and 'Employee Data'!$Q$8:$Q$18 with your date range. Keep the ranges the same size and aligned to the same rows.

Count matching records using real dates
How the date criteria work: The formula counts dates on or after the first day of the selected month and before the first day of the next month. Text that only looks like a date will not reliably match these criteria.
Count records in WPS Spreadsheets

Count monthly records by entity in WPS Spreadsheets

Use COUNTIFS in WPS Spreadsheets to count rows for an entity within a selected month and year.

  1. 1. Open the workbook: Open WPS Spreadsheets and use File > Open to select your workbook.
  2. 2. Set the criteria: Enter the year in A5, the month number in B5, and the entity in C8, or choose equivalent cells in your workbook.
  3. 3. Add the formula: Select a result cell and enter =COUNTIFS('Employee Data'!$I$8:$I$18,$C8,'Employee Data'!$Q$8:$Q$18,">="&DATE($A$5,$B$5,1),'Employee Data'!$Q$8:$Q$18,"<"&EDATE(DATE($A$5,$B$5,1),1)).
  4. 4. Adapt and check: Replace the sheet name and ranges with your own, press Enter, and check the result against the matching rows.
Count matching entities within precise monthly date boundariesOpen and edit Microsoft Excel XLSX and XLS filesUse familiar spreadsheet formulas and cell referencesWork with a free, easy-to-use office suite
microsoft office alternative - wps office

Frequently Asked Questions

Why does the date formula return zero when matching records exist?

Check that the date column contains real dates rather than text. Also verify that A5 contains the year, B5 contains a month number from 1 to 12, and C8 matches the entity text.

Will the formula count dates that include a time?

Yes. The real-date formula uses a lower bound of the first day of the month and an exclusive upper bound of the first day of the next month, so times within the selected month are included.

Can I use a month name instead of a month number?

For real dates, enter the corresponding month number in B5, such as 7 for July. For month-and-year text, enter the month name in Q7 and use the wildcard formula.

Why must the COUNTIFS ranges cover the same rows?

COUNTIFS compares criteria across corresponding cells. Use ranges of the same size, such as I8:I18 for entities and Q8:Q18 for dates, so each entity is compared with the date on the same row.