Find the date that corresponds to the lowest price in the last X months

JenniferMurphy

Well-known Member
Joined
Jul 23, 2011
Messages
2,526
Office Version
  1. 365
Platform
  1. Windows
I have a workbook with records of items I buy regularly. Each product has its own sheet. There is one row for each purchase with columns for Date, Quantity, Price, Price per pound, etc.

Each sheet has a cell showing the lowest price (BestPrice) I ever paid and another showing the date of that purchase.

The named ranges are:
  • RangeDate: The list of purchase dates
  • RangePrice: The list or prices paid
The lowest price and the date of that purchase are obtained with these expressions:
Code:
=MIN(RangePrice)
=INDEX(RangeDate,MATCH(BestPrice,RangePrice,0))

That all works. But some of these sheets have records going back many years. If the lowest price was 15 years ago, it's not really a fair comparison to today's prices.

Here's my question: How can I find the date of the lowest price paid in the last X years without writing a UDF?
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Why not just filter out all dates greater than 15 years and work with that data. Once filtered, move the remaining data to a new sheet/file.
 
Upvote 0
Why not just filter out all dates greater than 15 years and work with that data. Once filtered, move the remaining data to a new sheet/file.
Several reasons:
  • I may want to change the time period and I don't want to have redo the extraction process.
  • I don't want to have to redo the extraction process every year or so when some records are now older than X years.
I want a dynamic result that works on all of the data.
 
Upvote 0
Try something like this:

Enter a minimum date in a cell and name it MinDate
Name appropriate cells:
VBA Code:
MinDate      =a minimum date to consider: eg 2018-01-01
MinPrice     =MINIFS(RangePrice,RangeDate,">="&MinDate)
MatchDate    =MAXIFS(RangeDate,RangeDate,">="&MinDate,RangePrice,MinPrice)

Is that something you can work with?
 
Upvote 0
Solution
Try something like this:

Enter a minimum date in a cell and name it MinDate
Name appropriate cells:
VBA Code:
MinDate      =a minimum date to consider: eg 2018-01-01
MinPrice     =MINIFS(RangePrice,RangeDate,">="&MinDate)
MatchDate    =MAXIFS(RangeDate,RangeDate,">="&MinDate,RangePrice,MinPrice)

Is that something you can work with?
Thank. ?? Sorry for the very late reply. ??
 
Upvote 0

Forum statistics

Threads
1,214,659
Messages
6,120,786
Members
448,993
Latest member
Seri

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top