Question

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.

Was it helpful?

Solution

You can use formula with 3D-reference like this:

=MAX(Sheet1:Sheet30!A2)
  1. Click the cell where you want to enter the function.
  2. Type = (equal sign), enter the name of the function (MAX), and then type an opening parenthesis.
  3. Click the tab for the first worksheet that you want to reference.
  4. Hold down SHIFT and click the tab for the last worksheet that you want to reference.
  5. Select the cell or range of cells that you want to reference (A2 in your case).
  6. Complete the formula (add closing parenthesis), and then press ENTER.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top