Go Back

Date is same month and year

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

General Formula

=MONTH(date1)&YEAR(date2)=MONTH(date1)&YEAR(date2)

Formula

=MONTH(B5)&YEAR(B5)=MONTH(C5)&YEAR(C5)

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
    =MONTH(B5)&YEAR(B5)=MONTH(C5)&YEAR(C5)
  • 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

Explanation

=MONTH(B5)&YEAR(B5)=MONTH(C5)&YEAR(C5)

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

=“1201”= “1201”

=TRUE

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.

Did this post not answer your question? Get a solution from connecting with the expert.

Another blog reader asked this question today on Excelchat:
Here are some problems that our users have asked and received explanations on

I need help with the following: Sales: Year-to-date. For each Rep Group, summarize year-to-date sales (ending in the month selected) compared to year-to-date sales (ending the same month in the year prior to the selected year). For example, if June and 2018 are selected in the two drop-down lists, then this report would compare year-to-date sales from Jan 2018Jun 2018, with year-to-date sales from Jan 2017Jun 2017. Hint: For example, how will using the number of the month instead of the name of the month help you create a formula to easily summarize all sales ending in June (month 6)? Average Unit Price: Year-to-date. For each Rep Group, summarize average year-to-date unit price (ending in the month selected) compared to average year-to-date unit price (ending the same month in the year prior to the selected year). For example, if June and 2018 are selected in the two drop-down lists, then this report would compare year-to-date sales from Jan 2018Jun 2018 with year-to-date sales from Jan 2017Jun 2017.
Solved by Z. S. in 26 mins
I am trying to figure out how to take a fiscal year field and month field and create a date in xx/xx/xxxx format in Excel. The fiscal year is October -September. If the month is October November or December, the date will correspond to the previous year of the fiscal year (ie if the month is "October" and the fiscal year is 2010- the date would read "10/1/2009").
Solved by Z. H. in 26 mins
in the worksheet named 'compare', i need to sum the MONTHLY TOTAL TO DATE FOR THIS YEAR AND COMPARE WITH LAST YEAR FOR THE SAME PERIOD. These month to date totals are needed for 5 seperate shops (in column E..'TYPE') The red '?' indicate where I need the formula). All the sales data are in the tab 'Customer orders' with the shop type in column A. NB, that todays day of month is 1 day earlier than same day last year, ie ...todays month to date figures for this year would be summing all sales from August 1st 2018 to today August 24 2018, but for last year we would be summing August 1st 2017 to August 25th 2017...
Solved by O. S. in 22 mins

Leave a Comment

avatar