Go Back

Get last entry by month and year

We can use the LOOKUP function and the TEXT function to get the last entry by Month and Year in a data. The steps below will walk through the process.

Figure 1: How to Get Last entry by Month and Year

General Formula

=LOOKUP(2,1/(TEXT(dates,"mmyy")=TEXT(A1,"mmyy")),values)

Formula

=LOOKUP(2,1/(TEXT($B$4:$B$11,"mmyy")=TEXT(E6,"mmyy")),$C$4:$C$11)

Setting up the Data

  • We will set up data by inputting our Dates (month and year) in Column B and Sales in Column C
  • Our result will be returned in Column F by the formula. We intend to know the last SALE VALUE that was added to the table for each month

Figure 2: Setting up the Data

Note- We have formatted the dates by doing the following. First, we will type the dates in this format into COLUMN B: 1/1/2019. We will highlight the dates from Cell B4 to Cell B11. We will right-click and click on format cells.

Figure 3: Formatting the Dates

  • We will click on Custom and select mmm-yy. We will press OK
  • We will do the same thing for the LOOKUP dates. However, we will simply type the month and year instead. For instance, Jan 2019

Get Last entry by Month and Year

  • We will click on Cell F6
  • We will insert the formula below into the cell
    =LOOKUP(2,1/(TEXT($B$4:$B$11,"mmyy")=TEXT(E6,"mmyy")),$C$4:$C$11)
  • We will press the enter key

Figure 4: Last entry for January 2019

  • We will click on Cell F6 again
  • We will double click on the fill handle tool which is the small plus sign you see at the bottom right of Cell F6. Select and drag down to copy the formula to other cells.

Figure 5: Last entries for January, February, and March 2019

We can confirm our result by looking at the exact dates in figure 2.

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 have a problem regarding to Get last entry by month and year
Solved by X. L. in 29 mins
trying to get current (today, last 7 days, month, year, all time) Net Profit sum of that day or last 7 days or month or year. So A4:a999 will be my dates, K4:k999 will be profits,
Solved by B. B. in 21 mins
I need to create a report that shows the last 2 years and current YTD sales by state, by month, by year in a side to side comparison as well as find the average by month. I have no clue where to start. Tab - Sheet 5.
Solved by A. L. in 14 mins

Leave a Comment

avatar