I have an Excel workbook with many sheets (today, about thirty, and growing every day). Each worksheet is named for the date of the data it contains (e.g., 02-10, 02-11, etc.). In cell A2 of each worksheet is a number, and I want to write a formula that looks at cell A2 in every worksheet, and returns the largest one.
I created a list of the current worksheets and named it DayWorksheets, and I attempted to get the value using the formula
{=MAX(INDEX(INDIRECT("'"&DayWorksheets&"'!A2"),0))}
(brackets shown to denote array formula).
But the result every time is "10," which is the number in cell A2 of the first worksheet in the named range (and it's not the largest). What am I doing wrong here? I've seen a few other formulas around, the likes of
=VLOOKUP(C1,INDIRECT("Sheet"&MATCH(TRUE,COUNTIF(INDIRECT("Sheet"&ROW(INDIRECT("1:10"))&"!A2:A100"),B1)>0,0)&"!A2:B100"),2,0)
,
but I don't quite understand the purpose of the countif
function in there. Any help would be appreciated.