Create a Copyable COUNTIFS Formula Across Excel Employee Sheets
Question details
Create a formula that counts monthly absence entries across separate employee worksheets and can be copied down and across a summary sheet.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- An absence workbook has one worksheet per employee, with dates in column A and occurrence values in column D.
- Observed behavior
- The desired formula should switch employee worksheets when copied down and switch months when copied across.
Check that each employee sheet has dates in column A and occurrence values in column D, and decide whether you need to count entries or sum their values. On a summary sheet, reserve column A for exact employee sheet names and row 1 for actual first-of-month dates.
Use INDIRECT and COUNTIFS to count monthly entries
Use this formula to count rows with a positive occurrence value for each employee and month.
The mixed references $A2 and B$1 let the employee sheet change when the formula is copied down and the month change when it is copied across. INDIRECT builds the sheet references, while EOMONTH defines the end of the month.
Each matching row counts as one, even if its occurrence value is 0.5. The formula also includes dates with time values on the last day of the month.
On your summary sheet, enter each employee worksheet name in column A, starting in A2. The names must match the sheet tabs exactly.
Enter a real first-of-month date in B1, such as 1/1/2019. In C1, enter =EDATE(B1,1) and copy it across to create later month headers.
In B2, enter =COUNTIFS(INDIRECT("'"&SUBSTITUTE($A2,"'","''")&"'!A:A"),">="&B$1,INDIRECT("'"&SUBSTITUTE($A2,"'","''")&"'!A:A"),"<"&EOMONTH(B$1,0)+1,INDIRECT("'"&SUBSTITUTE($A2,"'","''")&"'!D:D"),">0").
Select B2 and drag its fill handle down for the employee rows, then across for the month columns. Check a result against the corresponding employee sheet.

Use SUMIFS when occurrence values must be totaled
Use this approach if values such as 0.5 represent fractional occurrences that should be added rather than counted as whole rows.
Build the monthly absence summary in WPS Spreadsheets
Use WPS Spreadsheets to create the same employee-by-month summary with COUNTIFS, INDIRECT, and EOMONTH, then save the workbook in Excel format.
- 1. Open the workbook: In WPS Spreadsheets, use Open to select the absence workbook, then open or add a summary sheet.
- 2. Add names and dates: Enter employee sheet names in A2 and below. Enter a first-of-month date in B1, then use =EDATE(B1,1) in C1 and fill across.
- 3. Enter the count formula: In B2, enter =COUNTIFS(INDIRECT("'"&SUBSTITUTE($A2,"'","''")&"'!A:A"),">="&B$1,INDIRECT("'"&SUBSTITUTE($A2,"'","''")&"'!A:A"),"<"&EOMONTH(B$1,0)+1,INDIRECT("'"&SUBSTITUTE($A2,"'","''")&"'!D:D"),">0").
- 4. Fill and save: Drag the fill handle down and across, verify the results, and use Save As to save an XLSX workbook.

Frequently Asked Questions
Why does the formula show a reference error?
Check that the name in column A of the summary sheet exactly matches an employee sheet tab. INDIRECT cannot resolve a sheet name that does not exist.
Why does a 0.5 occurrence count as one?
COUNTIFS counts matching rows, not the values in column D. Use the SUMIFS solution if 0.5 should contribute half an occurrence to the monthly total.
Can the formula include dates that have times?
Yes. The condition <EOMONTH(B$1,0)+1 includes all times on the last day of the month, provided column A contains real Excel date and time values.
Why are the month results incorrect?
Check that each header in row 1 is a real date set to the first day of its month, not text. Also verify that employee dates in column A are stored as dates.
How can I improve performance in a large workbook?
Replace full-column references such as A:A and D:D inside INDIRECT with consistent bounded ranges, such as A2:A1000 and D2:D1000, that cover your data.




