Match dates and prices

D

daniroy

thanks in advance for anybody that could provide me with help on this
part of code that is - I guess - possibly very easy to write but I have
no idea of how to sort it out.

I have a column A containing product names. Only two products exist and
they are irregularely sorted as
Column A
Product A
Product B
Product B
Product A
Product B
Product A
and so on
the lenght of this column will be irregular from day to day. It can be
7 lines today, 12 tomorrow, 100 the day after.

On column B, I have dates which are associated with products. Dates
would always be in ascending order, from the most recent to the most
distant from now on, whatever the sorting of Products in column A. It
would thus look as:
Column A Column B
Product A 21/04/2006
Product B 19/05/2006
Product B 22/06/2006
Product A 11/07/2006
Product B 12/08/2006
Product A 05/09/2006
and so on

On column P, I would have a serie of dates, sorted by ascending order,
from the most recent to the most distant from now on, all corresponding
to product B dates, such as
Column P
19/05/2006
22/06/2006
12/08/2006
and possibly more, if Column A includes more "Product B" lines.
Column R associate the prices of "Products B" at a certain point in
time ie Column P
Column P Column R
19/05/2006 250
22/06/2006 180
12/08/2006 370
and so on, function of the number of "product B" present in Column
A.
On this basis, what I am aiming to do, is to match in Column C the
price existing in Column R for the "Product B" from Column A with
corresponding Column B date, or for instance

Column A Column B Column C
Product A 21/04/2006
Product B 19/05/2006 250
Product B 22/06/2006 180
Product A 11/07/2006
Product B 12/08/2006 370
Product A 05/09/2006

I could implement a vlookup in Column C, linked to columns P, R. But
user would crash the formula for sure. I thus need matching to be made
in VB code and "pushed" into Column C. Moreover, a vlookup would
not sort the fact that columns A, B can be made of 10 or 1000 lines,
from one day to the other.
I am, obviously, unable to code this. I thus would be extremely
thankful to any help that anybody can provide...

I wish you all the best
Daniel
 
D

Don Guillett

If? I understand you properly you might like to look in vba help index for
FINDNEXT.
using c.offset(0,3)
 
D

daniroy

I am sorry but I am not sure to understand how it can help me ...
probably my fault to be fair ... I am not really seeing how to
implement this. Thanks again for any help ...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top