We can use the MONTH and YEAR functions to test if two dates share the same month and year in Excel. The following steps will walk through the process.
Figure 1: Result of Date is the same month and year
Setting up the Data
- We will input our dates in Column B and Column C
- Column B will contain the values for Date 1
- Column C will hold the values for Date 2
- Column D is where we will insert the Formula. It will return TRUE if the date is shared or FALSE, if not.
Figure 2: Setting up the Data
Applying the MONTH and YEAR functions
- We will click on Cell D5
- We will insert the formula below into the cell
- We will press the enter key
Figure 3: Applying the MONTH and YEAR functions
- We will click on Cell D5 again
- We will double click on the fill handle tool (the small plus sign at the bottom right of Cell D5) and drag down to copy the formula into the other cells.
Figure 4: Result of Date is the same month and year
With this formula, the month is extracted from the date in Cell B5 as a number. This is represented in the form of a text string. The same will be done with the date in Cell C5. The year and month extracted will be combined. Lastly, the formula will check to see if the dates are equivalent and the formula is solved in the following way:
=MONTH(B5)&YEAR (B5)=MONTH(C5)&YEAR (C5)
=1 & 2011=1 & 2011
Instant Connection to an Expert through our Excelchat Service
Most of the time, the problem you will need to solve will be more complex than a simple application of a formula or function. If you want to save hours of research and frustration, try our live Excelchat service! Our Excel Experts are available 24/7 to answer any Excel question you may have. We guarantee a connection within 30 seconds and a customized solution within 20 minutes.