I’ll try to explain as simple as possible, cause the real thing is a bit more big than I’d like. Let’s say that I have a two tables, one where I have the date of every day next to a product, and another table with a specific dates next to a price:
Date | Product
--------------------
1/1/2013 | Apple
--------------------
1/2/2013 | Orange
--------------------
1/3/2013 | Pineapple
--------------------
1/4/2013 | Kiwi
ChangeDate | Price
-------------------
1/3/2013 | 1.99
--------------------
1/6/2013 | 0.95
What I need to do is assign the column of price to the first table, but that it changes according to the ChangeDate column. So, for instance, the first two entries of the first table will have 1.99 as price, but the after the third entry, which coincides with the first changeDate, the price changes to 0.95, and the price will stay as such until another entry coincides with the next changeDate.
My problem is that I don’t know how to dynamically alter this condition. I’m using something along the lines of IF($F$1 < A1, G1, G2) where F1 is the changeDate, A1 is the date of an entry of the first table, G1 is the price next to F1, and G2 is the price that follows. What can I do so that, when F1 is bigger than A#, the next time the condition becomes F2? Do I need to use VBA? (All the information is already on the sheets, no user input is needed or used).
Thanks in advance.
Wouldn’t you need an initial price to begin with? I’ll assume so, and that it is the first entry in the price change table, with an entry date of 1/1/2013.
Then, you would be able to use a straightforward vlookup. If your products are in A2:B5 and your prices are in D1:E3 (including the entry for the initial price), then the formula for the first entry in the product table would be: