I'm trying to create a VLOOKUP formula in excel, however, the table array may be in a number of different worksheets.
For example, I have this forumula
=Vlookup(a1, ‘[Datafile.xlsx]worksheetapples’!$A1:F500,3,False)
This works fine in a single scenario, but worksheetapples
isn't my only worksheet that I want to do a lookup from, I have worksheetbananas
and worksheetpears
Is there a way to pass in the worksheet to reference?
EDIT: I'm trying to avoid having to write an IF
formula which checks a value and then uses the relevant VLOOKUP. It would be much easier to pass in the name of the worksheet rather than check if A1 is apples, do VLOOKUP on apples, if A1 is pears then do lookup on pears etc
Best Answer
Try using INDIRECT, as in
where B1 contains the sheet name.