Hi Rahul ,
I am not so sure ; if you see the formula :
=VLOOKUP(A4,INDIRECT("'"&INDEX(sheetlist,MATCH(1,--(COUNTIF(INDIRECT("'"&sheetlist&"'!$A$1:$c$4"),A4)>0),0))&"'!$A$1:$c$4"),2,FALSE)
it is following the syntax of a VLOOKUP function , which is :
=VLOOKUP(value , range address , column number , TRUE or FALSE)
Here , the range address is arrived at by :
INDIRECT("'"&INDEX(sheetlist,MATCH(1,--(COUNTIF(INDIRECT("'"&sheetlist&"'!$A$1:$c$4"),A4)>0),0))&"'!$A$1:$c$4")
We have a named range called sheetlist , which contains the names of all the concerned sheet tabs.
The MATCH function tells us which entry in this named range ( i.e. which sheet tab ) has the value we are looking for ; the COUNTIF function returns an array of values , which will have 1 if the value was found in a particular sheet tab , and 0 if it was not found e.g. {1;0;0;0} if the value was found on the sheet tab labelled Sheet2 , {0;1;0;0} if the value was found on the sheet tab labelled Sheet3 , and so on.
The only simplification can be this :
MATCH(1,COUNTIF(INDIRECT("'"&sheetlist&"'!$A$1:$c$4"),A4),0)
instead of this :
MATCH(1,--(COUNTIF(INDIRECT("'"&sheetlist&"'!$A$1:$c$4"),A4)>0),0)
This is valid provided the value being looked up does not occur more than once on a sheet tab.
Narayan