Get excel worksheet name with INDIRECT and use it in range
I have a formula that looks for matching value in particular range of particular worksheet, as
MATCH(D6,'Common'!N14:N500,-1)
Common
is the name of a worksheet.
I would like to take name Common
in this formula form another cell contents, e.g. B5
I tried to use
=MATCH(D6,'&INDIRECT("B5")&'!N14:N500,-1)
but in vain. What must be the correct syntax?
INDIRECT
must contain a text representation of the whole reference, so
=INDIRECT(B5&"!N14:N500")
and
=MATCH(D6,INDIRECT(B5&"!N14:N500"),-1)
Single quote marks are not necessary around a worksheet name if it does not contain spaces, so Common!N14:N5000
is a valid reference (though you can use 'Common'!N14:N5000
also).