Array Reference

A

anar_baku

Hi,

Is it possible to make Array References dynamic?

For example I have a formula which is something like this:
=VLOOKUP(A1, [excelFile.xls]*sheetTab*!A1:C10, 2, FALSE)

Is it possible for the value of *sheetTab* in above to depend on the
value of a cell?

So instead of above, I would have something like this:
=VLOOKUP(A1, [excelFile.xls]*A2*!A1:C10, 2, FALSE)

Obviously this formula doesn't work, but hopefully I got my point
accross.


Thanks in advance
 
G

Guest

Check out the INDIRECT formula. Allows you to turn a string of text into a
cell reference (or range). You could construct your string dynamically, then
turn it into a range using the formula.
 
A

anar_baku

Great stuff, didn't know of this function before! Thanks a lot!

Is there a way of using this as part of a reference though? So could
have something like:

=VLOOKUP(A1, [excelFile.xls]INDIRECT(A2)!A1:C10, 2, FALSE
 
V

vezerid

Yes, you can do it with the following syntax:
=vlookup(a1, indirect("'[excelfile.xls]" & a2 & "'!a1:c10"), 2, false)

As you see, we use the concatenation operator to build the entire
reference for the 2nd argument using INDIRECT().

HTH
Kostis Vezerides
 

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