How to Compare Current and Previous Month Leave Data with Excel Formulas
Question details
The user needs to calculate and compare total leave days or hours used in the current month versus the previous month using Excel formulas.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Tracking and comparing monthly employee leave totals in a LeaveTracker table containing dates and hours.
- Observed behavior
- The user wants to establish a reliable formula approach to compare monthly totals without encountering calculation errors caused by directly comparing month names.
Ensure your LeaveTracker table has a dedicated column formatted as valid Dates (e.g., MM/DD/YYYY) and numeric columns for total days or hours used.
Use SUMIFS with EOMONTH for Accurate Date Boundaries
Calculate monthly totals by setting precise date boundaries using the SUMIFS function, preventing errors related to cross-year data or duplicate month text strings.
Using SUMIFS with strict start and end dates is the most reliable way to sum data by month. By combining it with the EOMONTH function, you can dynamically calculate current and previous month totals without hardcoding dates.
Determine the first day of the current month. If calculating based on today's date, the start boundary is ">=" & EOMONTH(TODAY(),-1)+1. The exclusive end boundary (first day of next month) is "<" & EOMONTH(TODAY(),0)+1.
Use the SUMIFS formula to sum the hours for the current month. For example: =SUMIFS(LeaveData[Hours], LeaveData[Date], ">=" & EOMONTH(TODAY(),-1)+1, LeaveData[Date], "<" & EOMONTH(TODAY(),0)+1).
To sum the previous month's data, shift the boundaries back by one month. The formula will be: =SUMIFS(LeaveData[Hours], LeaveData[Date], ">=" & EOMONTH(TODAY(),-2)+1, LeaveData[Date], "<" & EOMONTH(TODAY(),-1)+1).
Subtract the previous month's total from the current month's total to find the difference, or calculate the variance percentage using the formula: =(Current Month Total / Previous Month Total) - 1.

Track and Compare Leave Data Easily in WPS Spreadsheet
WPS Spreadsheet fully supports SUMIFS, EDATE, and EOMONTH functions, allowing you to seamlessly track employee leave, build dynamic dashboards, and manage complex datasets.
- 1. Open your LeaveTracker: Launch WPS Spreadsheet and open your existing .xlsx leave tracker file.
- 2. Apply the SUMIFS Formula: Select the cell for your current month total and input the SUMIFS formula using the EOMONTH date boundaries.
- 3. Analyze the Data: Use WPS Spreadsheet's built-in charts or conditional formatting to visually compare the current and previous month's leave usage.

Frequently Asked Questions
Why does my SUMIFS formula return an error when comparing dates?
This usually happens if the logical operators and cell references are not properly concatenated in the formula. Ensure your condition looks like ">=" & A1 rather than ">=A1", as Excel requires the operator to be in quotation marks and joined to the cell reference with an ampersand.
How can I compare month names instead of actual dates?
While you can add a helper column using the =TEXT(A2, "mmmm") function to extract the month name, this method fails to distinguish between years (e.g., January 2023 vs. January 2024). Using exact date boundaries is always recommended for long-term data sets.
What is the EDATE function used for in this context?
The EDATE function returns the exact same day of the month a specified number of months in the past or future. For example, =EDATE(A2, -1) returns the date exactly one month before the date in cell A2, which helps in dynamically shifting your comparison windows.
Can I use PivotTables to compare monthly leave data instead of formulas?
Yes, you can insert a PivotTable, group the date field by 'Months' and 'Years', and use the 'Show Values As' feature (specifically 'Difference From' or '% Difference From') to easily display the variance from the previous month without writing complex formulas.




