问题
I'm trying to make the vlookup function below 'dynamic' by substituting a portion of the sheet name with the value in a cell.
Current vlookup function
=VLOOKUP($B$4,studentA!A2:D,2)
Desired vlookup function uses the value in cell C4
to identify the student sheet
=VLOOKUP($B$4,studentC4
A2:D,2)
Can someone please help me with the syntax for this?
回答1:
Use INDIRECT
, e.g.
=VLOOKUP($B$4,INDIRECT("student"&C4&"!A2:D"),2)
来源:https://stackoverflow.com/questions/48694257/how-to-make-the-search-range-dynamic-in-a-vlookup-function