Excel dynamic array formula - excel

I have a workbook with 11 sheets for each month, and one summary sheet.
On each sheet is a list of website in column A between A2 and A13, and in column B are some values taken from those website.
The individual Month sheets look something like this:
HOWEVER, it is possible that the information may be in a different order, so I have had to use MATCH to find the row where I want to get the data from.
The summary sheet looks something like this:
I want to build a formula that will sum all the values across the 11 worksheets for each website.
I tried to use INDEX and MATCH like this:
=INDEX(January!$A$2:$B$12,MATCH($A3,January!$A$2:$A$13,0),2)
Now this works for January and copies down for all the web-sites ok, but I'd like to SUM all the worksheets without adding the formulas?
How can I do something like this across all the worksheets?
It seems a bit naff to just add a plus sign and write eleven formulas in each cell

Create a named range (eg) SHEETS containing your sheet names (in a column)
In B3 on your summary sheet:
=SUMPRODUCT(SUMIF(INDIRECT(SHEETS & "!A2:A11"), A3, INDIRECT(SHEETS & "!B2:B11")))
and fill down

Related

Filter rows from multiple sheets in Excel without VBA

I have an Excel file with three sheets, with data in each sheet organised in the same manner - headers are the same.
Without using VBA (as macros are not allowed by my organisation's security policy), I would like to find all rows from all sheets that meet a simple column value check and show those rows in a separate sheet.
For example:
Sheet2 has,
Sheet3 has,
Sheet4 has,
I want sheet1 to have all rows from sheets 2-4 with Header7 column value = "Hit",
What I have achieved so far is, using an array formula I could get all the "hits" from one sheet in sheet1.
The formula for A2 to A6 in sheet1 is as below, with the ROW(1:1) changing to ROW(2,2) and so on from A3 onwards. Columns B to G use the same formula with range adjusted accordingly.
{=IFERROR(INDEX(Sheet4!$A$2:$A$6,SMALL(IF(Sheet4!$G$2:$G$6="Hit",ROW(Sheet4!$A$2:$A$6)),ROW(1:1))-1,1),"")}
What this does is a bit complicated. In short, it creates an array of either FALSE or row numbers based on Hit and then finds the index of the non-false values.
Now, I can solve the last part of combining the idea to include all sheets in two ways (I think).
Have another temporary sheet (sheet5) with all rows from sheets 2 to 4. Update my formula in sheet1 to use sheet5 instead of 4.
Have the range Sheet4!A2:A6 etc changed to include a 3D reference like Sheet2:Sheet4!A2:A6. But this doesn't work, and the documentation for 3D reference doesn't mention that it works with array functions.
PS: I don't have Power Query, which seemed to have an easy way to create a new sheet with all rows from multiple sheets, because I work on a Mac (MS Excel for Mac).

Excel Formula to sum cell over multiple sheets

I have an Excel document that I need to have a totals sheet which takes in a specific cell over multiple sheets. It also needs to be expandable so I can just add the sheet name to a row or something and it will add it into the formula and the total.
Just a row like this or something similar which could be used to add more sheets in future.
To give you an example currently, I am using a simple SUM function but it's not easily expandable:
=SUM('Sheet1'!A6,'Sheet2'!A6,'Sheet3'!A6)
I have had a look at INDIRECT but I can't find a way of having it expand to the length of an array eg. something like this:
=SUM(INDIRECT(H3:H8,"!A6"))
Would return all the values of A6 across each sheet named in H3:H8 evaluating like:
=SUM(INDIRECT(H3,"!A6"),INDIRECT(H4,"!A6"),INDIRECT(H5,"!A6")...)
If anyone has any ideas of what I can use to achieve this, it would be very helpful!
If you want a dynamic list of sheets for your sum formula, you may
Put the names of the sheets across which you would like to sum your cell(s) on a separate range of cells organized as a column range:
Sheet1
Sheet2
...
Convert the cells with the names of sheets into a table (select your range, then on the main menu panel select "Insert - Table").
Name the created table list (i.e. "List_of_Sheets")
To sum use the formula:
=SUMPRODUCT(SUM(INDIRECT("'"&List_of_Sheets&"'!A6")))
You may change the names of sheets in your table or add the new ones at the end of the table
Try this,
SUM(Sheet1:Sheet3!A6)
You can add a Sheet named „Start“ and one named „End“.
Place all sheets you want to sum between the both. So you can use
SUM(Start:End!A6)

COUNTIFS with different-sized ranges / INDEX-MATCH and COUNTIF

Headline: I need to make a summary table that, for each row, looks to another sheet, finds the corresponding row based on a criteria (name), and counts the number of instances of a certain value ("P") across several columns.
Specifics:
I am making a summary "cover sheet" for an excel doc that summarizes information from other sheets. So, Sheet1 looks like this:
....and I want to fill in the "Attendance" column (B:B) on this sheet. I want it to do this by counting the number of P's in another sheet. Sheet2 looks like this:
(note that names are not in the same order as on Sheet1)
Desired outcome (which I hand-entered here):
IMPORTANTLY/Annoyingly: Because of some annoying rules & regulations, I'm not allowed to simply add a helper column to Sheet2 (E:E) (=countif(B2:D2,"P") that I'd then simply import in (=INDEX(Sheet2!E:E, MATCH(A2, Sheet2!A:A, 0)).
I've tried making a hybrid INDEX-COUNTIF & a hybrid COUNTIF-MATCH solution, but to no avail.
My best guess was using COUNTIFS, but when I do COUNTIFS(Sheet2!A:A, A2, Sheet2!B:E,"P")) I get an error message that says, "Array arguments to COUNTIFS are of different size."
Any help would be appreciated!
=SUMPRODUCT((Sheet2!$A$2:$A$8=A2)*(Sheet2!$B$2:$D$8="P"))
Place the above formula in Sheet1, cell B2 and copy down.

Using internal excel sheet name (i.e. sheet1, sheet2, sheet3) to sum a cell across multiple sheets

I'm trying to sum the same cell across multiple sheets. The number of sheets increases by one each week and will be a new Sheet1. Each sheet will get a date for it's name. The last sheet will have the sum totals. The three sheets prior to that will contain instructions. i.e. 20 sheets, data on sheets 1-16, instructions on sheets 17-19 and totals on sheet 20.
This Sum across dynamic number of sheets question uses a User-defined Function, =autosum, in each cell and could work. I would rather use VBA to create a macro. I know how to get total sheets and sum across all the sheets, where I'm lost is how to sum across (total sheets -4), i.e. sheets 1-16.
code I'm already using is
Dim sheets as Integer
sheets = Application.sheets.Count
=SUM('FirstSheet:LastSheet'!D6)
How do I get
=SUM('FirstSheet:(LastSheet-4)'!D6?
I want to use the internal excel sheet1, sheet2, etc. vs the date name on each sheet, at least for FirstSheet. I can hardcode LastSheet since it won't change.
You shouldn't need to use VBA, you can use the default sum formula. I recommend creating two blank sheets (e.g. "Start" and "End"), ensure that "Start" is always before the first sheet you want to some and "End" is always immediately after the last sheet you want to sum. Then, a formula like this would do what you're asking:
=SUM(Start:End!A1)
Edit: If the name of the first and/or last sheet that should be summed is static, you could avoid using the "start" or "end" placeholders and replace them with the names of the first/last sheets that should be summed.

Reference cells in another sheet using text in current sheet

I need to get numbers from cells in other sheets. I am currently doing the following in Sheet 1 in cell D14 (but also in another 100 cells):
=('Sheet Two'!$AA$69*'Sheet Three'!AA$70)
This gets me the information I need. As it happens though I have a cell in Sheet 1 with the names of the sheets I need the information from.
I would like a formula that references the cells in Sheet 1 to get the names so I wouldn't have to manually type in the different sheet names for 100 cells.
So if say I have written in text:
Cell A1: Sheet two
Cell A2: Sheet Three
I need something like:
=(***Name in Cell A1***!$AA$69*'***Name In Cell A2***'!AA$70)
=INDIRECT(INDIRECT("A1")&"$AA$69")*INDIRECT(INDIRECT("A2")&"$AA$70") seems to be of the nature of what you are asking for (where A1 contains ''Sheet Two'! but it looks as though a different layout might be much more effective, or use of Search and Replace.
You could use the INDIRECT formula as pnuts suggested, but simpler like this:
=INDIRECT("'",A1&"'!AA$69")*INDIRECT("'"&A2&"'!AA$70")

Resources