LOOKUP price based on date (but not necessarily the most recent date)

Yamezz

Active Member
Joined
Nov 22, 2006
Messages
329
Office Version
  1. 2019
I would like a formula to return the price of an item from a list that includes historical pricing.
I have been using the following formula to return the item price:
Excel Formula:
=VLOOKUP(L10718,InputCosts,2,FALSE)
which works well when there is only one price listed for an item. I now need to update the price going forward with the new price, however I don't want to update the historical records to the new price.
I need to use the date in column A to return the correct price, with logic something along the lines of: Price = most recent price from list, before the date in column A.
For example, if the Item in column L is "Pads" and the value in column A is 7-May, the result should be $3.50, but if the date is 5-May, then the result should be $2.75

My "InputCosts" table is attached. I'd appreciate any help I can get.
 

Attachments

  • 2022-05-08.png
    2022-05-08.png
    18.5 KB · Views: 7
, I did change create the table by selecting cells and using the Insert Table command, then I changed the table name to InputCosts.
That is not what your picture is showing.

Delete the Cost, Date and Item names from the Name Manager, then enter the formula I posted previously.

Be sure that the Item name that you are trying to look up from column L has exactly the same spelling as that item in the table. eg check for any trailing or leading spaces. If the formula cannot find any matching item names it would return a #NUM! error.
 
Upvote 0

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
The picture I posted was after I started again with a blank file and did not name the table. I was trying to get to the conditions you reference in the formula.

Either way, I've managed to get it going. It required me to put both the table and the formula on the one sheet so I could see where the cell references were not correct. When I dragged the references into place it worked, but errored out when I changed the test date. That was when I realised some of the dates got messed up between AU and US format. All is working now. Thank you Peter.
 
Upvote 0
Glad you got it resolved. Thanks for letting us know. (y)
 
Upvote 0

Forum statistics

Threads
1,214,823
Messages
6,121,779
Members
449,049
Latest member
greyangel23

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