Dynamic table array within Vlookup

Relentless

New Member
Joined
Feb 12, 2016
Messages
1
Hello and thank you in advance for your help! I've referenced this site many times and generally can find the answer to my questions but its just not coming together for me this time!

I'm simply trying to create a dynamic formula for the table-array within a vlookup. I have a large array with years worth of daily stock quotes for dozens of stocks. Unfortunately, the dates do not align for each ticker quote so within the array there are two columns for each stock symbol, one for the date and the other for the quote. Rather than spending the time to align the dates (that get constantly updated), I was attempting to create a vlookup that identified the right ticker and appropriate columns to return the correct stock price.

Here is tiny snapshot of the data set:
[TABLE="width: 620"]
<colgroup><col><col><col><col><col><col><col><col><col></colgroup><tbody>[TR]
[TD]Column =>[/TD]
[TD]BO[/TD]
[TD]BS[/TD]
[TD]BT[/TD]
[TD]BU[/TD]
[TD]BV[/TD]
[TD]BW[/TD]
[TD]BX[/TD]
[TD]BY[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]BRK B Date[/TD]
[TD]BRK B Price[/TD]
[TD]KMP Date[/TD]
[TD]KMP Price[/TD]
[TD]AHS Date[/TD]
[TD]AHS Price[/TD]
[TD]BHP Date[/TD]
[TD]BHP Price[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]2/8/11[/TD]
[TD]$84.27[/TD]
[TD]1/20/11[/TD]
[TD]$71.23[/TD]
[TD]2/25/11[/TD]
[TD]$7.53[/TD]
[TD]4/1/11[/TD]
[TD]$81.11[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]2/9/11[/TD]
[TD]$83.89[/TD]
[TD]1/21/11[/TD]
[TD]$71.88[/TD]
[TD]2/28/11[/TD]
[TD]$7.47[/TD]
[TD]4/4/11[/TD]
[TD]$82.00[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]2/10/11[/TD]
[TD]$84.45[/TD]
[TD]1/24/11[/TD]
[TD]$72.70[/TD]
[TD]3/1/11[/TD]
[TD]$7.27[/TD]
[TD]4/5/11[/TD]
[TD]$82.41[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]2/11/11[/TD]
[TD]$84.91[/TD]
[TD]1/25/11[/TD]
[TD]$72.59[/TD]
[TD]3/2/11[/TD]
[TD]$7.16[/TD]
[TD]4/6/11[/TD]
[TD]$83.40[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]2/14/11[/TD]
[TD]$85.30[/TD]
[TD]1/26/11[/TD]
[TD]$72.87[/TD]
[TD]3/3/11[/TD]
[TD]$7.47[/TD]
[TD]4/7/11[/TD]
[TD]$83.04[/TD]
[/TR]
</tbody>[/TABLE]

Here is the formula that isn't working (in bold where it fails)

=IF(TODAY()<$B81,"",IFERROR(VLOOKUP($B81, ADDRESS(4,MATCH(G4,A3:SS3,0)) & ":" & ADDRESS(5000,MATCH(G4,A3:SS3,0)+1),MATCH(G$4,$BO$3:$SS$3,0),TRUE),""))

I was using the two address functions to create the range for the table-array. By themselves the two address functions return: $BX$4 and $BY$5000 which is the range I want for that particular cell. However, I can't get vlookup to accept the output of the address functions as the range. I've tried playing with index and indirect functions which is where I think this is going but Its either not appropriate or I'm not using the correct syntax.

I could have probably manually re-input every variable in the array with the amount of time I've spent on this but now its personal! lol, I want to make it work!

Thank you for your assistance
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Welcome to Mr Excel

Assuming data in columns BO:SS, headers in row 3, if i understand what you are looking for, i.e.:
Given a date in B81 (for example 4/4/11) and a header in G4 (for example BHP Date), the formula should return the price (BHP Price) = $82.00

Maybe this
<b81,"",vlookup(b81,index(bo:ss,0,match(g4,bo3:ss3,0)):index(bo:ss,0,match(g4,bo3:ss3,0)+1),2,0))
=IF(TODAY() < B81,"",VLOOKUP(B81,INDEX(BO:SS,0,MATCH(G4,BO3:SS3,0)):INDEX(BO:SS,0,MATCH(G4,BO3:SS3,0)+1),2,0))

Hope this helps

M.</b81,"",vlookup(b81,index(bo:ss,0,match(g4,bo3:ss3,0)):index(bo:ss,0,match(g4,bo3:ss3,0)+1),2,0))
 
Last edited:
Upvote 0
Hi Marcelo,

I had an identical problem and the formula worked perfectly.
[h=3][/h]Best regards,
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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