# Refrencing a cell in a Index Formula

#### blimes

##### New Member
What I do is pull data from multiple sources on the internet sometimes it can be 500 rows sometimes 10000. I then have a sheet that uses a formula like =INDEX(B1:B10000,MATCH(R2,A1:A10000,0). I can set a cell up in say S1 That tells me there is 600 rows of data. is there a way to reference the 600 in Cell S1 to place the 10000 in the formula.

Thanks

### Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

#### Fluff

##### MrExcel MVP, Moderator
=INDEX(INDIRECT("B1:B"&S1),MATCH(R2,INDIRECT("A1:A"&S1),0))

#### arthurbr

##### Well-known Member
Perhaps=INDEX(B1:INDEX(B1:B100000,S1),MATCH(R2,INDEX(A1:INDEX(A1:A100000,S1))),0)

Last edited:

#### blimes

##### New Member
=INDEX(INDIRECT("B1:B"&S1),MATCH(R2,INDIRECT("A1:A"&S1),0))

Thank you much I tried this and it looks like it works now lets see if it speeds up my calculations.

Thanks again

#### Fluff

##### MrExcel MVP, Moderator
Try the formula posted by arthurbr as that is non-volatile & should be better.

#### blimes

##### New Member
Try the formula posted by arthurbr as that is non-volatile & should be better.
I tried but get an error message that i entered too few arguments?

#### Fluff

##### MrExcel MVP, Moderator
Try
=INDEX(B1:INDEX(B1:B100000,S1),MATCH(R2,INDEX(A1:INDEX(A1:A100000,S1),0),0))

#### blimes

##### New Member
Still get the same too few arguments?

#### blimes

##### New Member
Try
=INDEX(B1:INDEX(B1:B100000,S1),MATCH(R2,INDEX(A1:INDEX(A1:A100000,S1),0),0))
Now it is working. Thanks for the help not sure why i was getting error before.

#### Fluff

##### MrExcel MVP, Moderator
You're welcome & thanks for the feedback