Table of Contents
In the professional realm of data management and financial analysis, ensuring the consistency of chronological information is a fundamental task. When working within Microsoft Excel, users often encounter scenarios where they must verify if two specific dates fall within the exact same month and year, regardless of the specific day. To achieve this, one can employ a robust logical approach using the AND function in conjunction with the MONTH function and the YEAR function. This methodology allows for a precise comparison of disparate date values, resulting in a clear Boolean output of TRUE or FALSE. By isolating these temporal components, analysts can maintain high levels of data integrity without being distracted by day-level variances that might otherwise trigger false negatives in a standard equality check.
Beyond basic formulaic comparisons, advanced users frequently leverage Conditional Formatting to provide a visual layer of data validation. This feature is particularly effective for identifying discrepancies within large time series datasets, allowing for the immediate highlighting of cells where the month or year does not align with a target reference. Whether you are reconciling accounting records, managing project timelines, or organizing seasonal inventory, mastering these date-handling techniques is essential for creating reliable, automated spreadsheet models that respond dynamically to your data inputs.
Excel: Check if Month and Year Match Between Dates
To perform a rigorous check for matching month and year components across two different cells, you can implement a concatenation-based formula. This approach effectively merges the extracted numerical values into a single string for direct comparison. By using the following syntax, you can automate the verification process across your entire dataset:
=MONTH(A2)&YEAR(A2)=MONTH(B2)&YEAR(B2)This specific formula serves as a logical test that evaluates the month and year of the date residing in cell A2 against the corresponding month and year in cell B2. The algorithm extracts the month (as a value from 1 to 12) and the year (as a four-digit integer), joins them together using the ampersand operator, and then performs an equality check. If the combined strings are identical, Excel will populate the cell with a TRUE value; otherwise, it will return FALSE, providing an unambiguous result for your data analysis needs.
The following detailed example illustrates the practical application of this logic within a standard workbook environment, demonstrating how it scales across multiple rows.
Example: Check if Month and Year Match Between Dates
In many professional contexts, you might find yourself with two distinct columns of dates that represent different milestones, such as “Order Date” and “Shipping Date.” To ensure these events occurred within the same fiscal month, consider the following layout of metadata in an Excel worksheet:

To initiate the comparison, navigate to cell C2 and input the comparison formula. This formula utilizes the MONTH and YEAR functions to strip away the “day” portion of the date, which is critical because even if two dates occur in the same month, a difference in the day would cause a standard A2=B2 comparison to fail. By focusing exclusively on the month and year, you create a more generalized and useful filter for period-based reporting:
=MONTH(A2)&YEAR(A2)=MONTH(B2)&YEAR(B2)Once the formula is established in the initial row, you can efficiently apply it to the remainder of your database by using the fill handle. Simply click and drag the bottom-right corner of cell C2 downward to propagate the logic through all active rows in column C, as shown below:

Upon completion, column C serves as a dynamic indicator field. Each cell will display TRUE or FALSE based on the temporal alignment of the dates in columns A and B. This method is highly efficient for auditing financial statements or verifying that recurring transactions have been recorded in the correct period.
For users who prefer a more descriptive or user-friendly interface, the formula can be wrapped within an IF function. This allows the spreadsheet to return custom text strings such as “Match” or “Do Not Match” instead of the standard Boolean outputs. This is often preferred when the final spreadsheet is intended for presentation to stakeholders who may not be familiar with logical operators:
=IF(MONTH(A2)&YEAR(A2)=MONTH(B2)&YEAR(B2), "Match", "Do Not Match")The following visual representation demonstrates the enhanced clarity provided by this customized approach, making the information design more intuitive for the end user:

As observed in the screenshot, column C now provides explicit textual feedback. This transformation of raw data into clear status updates is a hallmark of high-quality business intelligence reporting, ensuring that any discrepancies are immediately obvious to the reader.
Understanding the Underlying Formula Logic
To truly master Excel, it is helpful to understand the internal processing that occurs when this formula is executed. Let us revisit the core expression used to compare the date values in cells A2 and B2:
=MONTH(A2)&YEAR(A2)=MONTH(B2)&YEAR(B2)The execution of this formula follows a specific sequence of operations that ensures accuracy regardless of how the dates are formatted on the surface. Here is a comprehensive breakdown of the internal logic:
First, Excel invokes the MONTH and YEAR functions independently for each referenced cell. These functions are designed to parse the underlying serial number that Excel uses to represent time. Once the individual components are extracted, the & operator (the concatenation tool) joins them into a single string of digits.
Consider an example where cell A2 contains the date January 15, 2023. The MONTH(A2) function returns 1, and YEAR(A2) returns 2023. When concatenated, the result is the string 12023.
If cell B2 contains January 20, 2023, the same process occurs: MONTH(B2) returns 1 and YEAR(B2) returns 2023, resulting in the concatenated string 12023.
Finally, the formula evaluates the statement 12023=12023. Because this mathematical and string identity holds true, the formula outputs TRUE. This logic effectively ignores the day of the month, allowing for a focused comparison of the broader time periods. This same computational logic is applied row-by-row, providing a scalable solution for datasets of any size.
Optimizing Date Comparisons for Large Datasets
When dealing with extensive big data environments, efficiency becomes paramount. Using the concatenation method is highly effective, but users should also be aware of the TEXT function as a viable alternative for date matching. For instance, using TEXT(A2, “mmyyyy”) can produce a similar result by converting the date into a formatted string. This can sometimes be easier to read during the debugging phase of spreadsheet development.
Furthermore, it is important to ensure that all cells are properly formatted as Dates rather than Text before applying these formulas. If a date is stored as text, Excel may struggle to extract the month and year correctly, leading to errors. Utilizing the Data Validation tools can help preemptively catch these formatting issues, ensuring that your data processing remains accurate and reliable.
Finally, always consider the impact of time zones and regional settings. If your dates include ISO 8601 timestamps, the MONTH and YEAR functions will still function correctly, but you may need to strip away the time component if it interferes with your specific comparison requirements.
Additional Resources and Excel Tutorials
To further expand your proficiency with Microsoft Excel and enhance your quantitative analysis skills, consider exploring our other comprehensive guides. These tutorials cover a wide range of common tasks, from advanced lookup functions to complex PivotTable configurations, designed to streamline your workflow and improve your productivity:
- How to use the VLOOKUP function for cross-referencing data.
- Mastering the INDEX and MATCH combination for flexible searches.
- Using Conditional Formatting to create dynamic heat maps.
- Automating repetitive tasks with simple Excel Macros.
Cite this article
stats writer (2026). How to Compare Month and Year Between Two Dates in Excel. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/how-can-i-check-if-the-month-and-year-match-between-two-dates-in-excel/
stats writer. "How to Compare Month and Year Between Two Dates in Excel." PSYCHOLOGICAL SCALES, 21 Feb. 2026, https://scales.arabpsychology.com/stats/how-can-i-check-if-the-month-and-year-match-between-two-dates-in-excel/.
stats writer. "How to Compare Month and Year Between Two Dates in Excel." PSYCHOLOGICAL SCALES, 2026. https://scales.arabpsychology.com/stats/how-can-i-check-if-the-month-and-year-match-between-two-dates-in-excel/.
stats writer (2026) 'How to Compare Month and Year Between Two Dates in Excel', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/how-can-i-check-if-the-month-and-year-match-between-two-dates-in-excel/.
[1] stats writer, "How to Compare Month and Year Between Two Dates in Excel," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, February, 2026.
stats writer. How to Compare Month and Year Between Two Dates in Excel. PSYCHOLOGICAL SCALES. 2026;vol(issue):pages.
