Function Problems

How to Count Excel Records for a Specific Month and Year

Steven ParkerSteven Parker Nov 3, 2026 870 views

Question details

The user needs to count the number of records in an Excel dataset that match a specific text criterion and fall within a given month and year.

How to Count Excel Records for a Specific Month and Year
Product
Excel
Device & OS
not provided
Scenario
Analyzing data where records need to be counted based on multiple conditions, specifically isolating entries from a certain month and year alongside another text condition.
Observed behavior
The goal is to accurately calculate the count without errors caused by time values attached to the dates or invalid date formats.
Before you start

Ensure that the column containing your dates is formatted as valid Excel dates, not as text strings, so the formulas can correctly interpret the month and year.

Solution 1Recommended

Use the COUNTIFS Function with Date Ranges

The most reliable method to count records for a specific month and year is by defining a date range with the COUNTIFS function.

By setting a 'greater than or equal to' start date and a strictly 'less than' end date for the following month, COUNTIFS accurately captures all dates within the target month. This method is exceptionally reliable because it prevents errors that occur when cells contain time values in addition to dates.

1
Select the destination cell

Click on an empty cell where you want the final count result to be displayed.

2
Enter the COUNTIFS formula

Type the formula =COUNTIFS(C2:C434,">="&DATE(2021,1,1),C2:C434,"<"&DATE(2021,2,1),A2:A434,"BB"). Replace the ranges with your actual data ranges.

3
Calculate the result

Press the Enter key. Excel will return the total number of records that match your text condition and fall within January 2021.

Use the COUNTIFS Function with Date Ranges
Pro Tip: Using the DATE function is generally safer than hardcoding dates as text (like ">=1/1/2021"), as it avoids regional date format errors depending on your system's localization settings.
Effortless Data Analysis

Master Complex Formulas with WPS Spreadsheet

WPS Spreadsheet offers a powerful and highly compatible environment for executing complex functions like COUNTIFS and SUMPRODUCT. Analyze your data effortlessly with its intuitive interface and advanced calculation capabilities.

  1. 1. Install the software: Download and install WPS Office Free on your computer or mobile device.
  2. 2. Open your dataset: Launch WPS Spreadsheet and open your existing Excel workbook containing the records.
  3. 3. Apply your formula: Select the target cell, paste your COUNTIFS or SUMPRODUCT formula, and let WPS instantly calculate your specific date and text criteria.
Seamless execution of COUNTIFS, SUMPRODUCT, and other complex date formulasFull compatibility with Microsoft Excel (.xlsx) formatsLightweight application that runs smoothly even with large datasetsBuilt-in formula auditing tools to easily track and fix formula errors
microsoft office alternative - wps office

Frequently Asked Questions

Why is my COUNTIFS formula returning zero when counting by date?

This usually happens if the dates in your dataset are stored as text rather than valid Excel date values. You can fix this by selecting the date column, navigating to the Data tab, and using the "Text to Columns" feature to quickly convert them to recognized dates.

Can I use cell references for the month and year instead of hardcoding them?

Yes. In both COUNTIFS and SUMPRODUCT, you can replace the hardcoded numbers (like 2021 or 1) with a cell reference (e.g., E1 for the year and E2 for the month) to make your reporting dashboard dynamic.

How do I handle cells that contain both date and time in these formulas?

The YEAR and MONTH functions within SUMPRODUCT automatically extract the correct year and month from a date-time serial number, ignoring the time. If using COUNTIFS, the safest approach is to set the end condition as strictly less than the first day of the following month (e.g., "<"&DATE(2021,2,1)), ensuring any times on the last day of the target month are fully captured.