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.
Leave a Comment