Date & Time
Check if two dates are in the same month and year
Compare EOMONTH(Date1, 0) = EOMONTH(Date2, 0) so prior-year dates in the same month number never trigger false matches.
Why MONTH(A2) = MONTH(B2) fails on multi-year ledgers
MONTH(DATE(2025, 4, 15)) and MONTH(DATE(2026, 4, 29)) both return 4—so checking MONTH alone merges April 2025 invoices into April 2026!
EOMONTH(date, 0) maps every date in April 2026 to the exact same serial (2026-04-30) while mapping April 2025 to 2025-04-30, testing both year and month in one concise equality.
| InvoiceDate (A) | CutoffDate (B) | MONTH Match? | EOMONTH Same Period? |
|---|---|---|---|
| 2026-04-03 | 2026-04-29 | TRUE | TRUE |
| 2025-04-15 | 2026-04-29 | TRUE (bug!) | FALSE |
EOMONTH equality vs explicit YEAR + MONTH check
Use INT(A2) inside EOMONTH if cells contain timestamps, though EOMONTH already ignores fractional clock times when computing month-end dates.
=EOMONTH(A2, 0) = EOMONTH(B2, 0)Explicit AND(YEAR, MONTH) alternative
AND(YEAR(A2)=YEAR(B2), MONTH(A2)=MONTH(B2)) expresses the exact same rule without date-offset functions.
=AND(YEAR(A2)=YEAR(B2), MONTH(A2)=MONTH(B2))Try the example
Use the original values or change them to test your understanding.