H
Harry Flashman
I am trying to use INDIRECT to refer to a range on a given worksheet
but am getting mixed results. Would some please inspect these formulas
and tell me what I am doing wrong?
Sheet1 contains a range; I would like to lookup a value in that range
from another worksheet.
This example works:
If the value in B1 is 1, then the following formula returns the
correct value
=VLOOKUP($A4,INDIRECT("Sheet"&B1&"!$A$1:$C$3"),2,0)
This example does not work:
But if the value in B1 is Sheet1 the the following formula returns
#REF!
=VLOOKUP($A4,INDIRECT(B1&"!$A$1:$C$3"),2,0)
In real life my worksheets will not have names like Sheet1, Sheet2 but
rather words like Region and Media etc
In the past, I have managed to get around this by naming the range on
each worksheet, and then using INDIRECT with cells containing the name
of my range, but this time I wanted to try something different.
I would be very appreciative if someone could guide me here. Thank you.
but am getting mixed results. Would some please inspect these formulas
and tell me what I am doing wrong?
Sheet1 contains a range; I would like to lookup a value in that range
from another worksheet.
This example works:
If the value in B1 is 1, then the following formula returns the
correct value
=VLOOKUP($A4,INDIRECT("Sheet"&B1&"!$A$1:$C$3"),2,0)
This example does not work:
But if the value in B1 is Sheet1 the the following formula returns
#REF!
=VLOOKUP($A4,INDIRECT(B1&"!$A$1:$C$3"),2,0)
In real life my worksheets will not have names like Sheet1, Sheet2 but
rather words like Region and Media etc
In the past, I have managed to get around this by naming the range on
each worksheet, and then using INDIRECT with cells containing the name
of my range, but this time I wanted to try something different.
I would be very appreciative if someone could guide me here. Thank you.