Querying Based on Historical Price

CT Witter

MrExcel MVP
Joined
Jul 7, 2002
Messages
1,212
I'm having a tempory loss of how to accomplish this. I have a table that has equipment id, cost and start and end date. I want to obtain the cost at a certain point in time based on the start / end date and the date the user provides.

Below is a copy of my table.
cost.xls
ABCD
1EquipIDCOSTStartDateEndDate
21$1,200.001/1/200512/31/9999
32$1,500.001/1/20051/15/2005
42$1,700.001/16/200512/31/9999
54$1,700.001/1/200512/31/9999
65$1,900.001/1/200512/31/9999
76$2,400.001/1/200512/31/9999
Sheet1



The user provides a date ie 1/13/05 for equipment id 2, the cost should be 1200. If they provided 1/16/05, then cost would be 1700.

Should I set up my table differently?

Thanks,
CT
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
With a query it would look like that.

Select cost from table where Date > startdate and date < Endate.
 
Upvote 0

Forum statistics

Threads
1,221,845
Messages
6,162,350
Members
451,760
Latest member
samue Thon Ajaladin

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