jason061872

New Member
I could use some help with this formula:
=IFERROR(SUMPRODUCT(SUMIFS(INDIRECT("'"&\$A\$4:\$A\$22&"'!B123:K123"),INDIRECT("'"&\$A\$4:\$A\$22&"'!B4:K4"),B4,INDIRECT("'"&\$A\$4:\$A\$22&"'!B5:K5"),\$Q\$9))/SUMPRODUCT(COUNTIFS(INDIRECT("'"&\$A\$4:\$A\$22&"'!B4:K4"),B4,INDIRECT("'"&\$A\$4:\$A\$22&"'!B5:K5"),\$Q\$9)),IF(N4=1,SUMPRODUCT(SUMIFS(INDIRECT("'"&\$A\$4:\$A\$22&"'!B123:K123"),INDIRECT("'"&\$A\$4:\$A\$22&"'!B4:K4"),B4,INDIRECT("'"&\$A\$4:\$A\$22&"'!B5:K5"),\$Q\$9))/1,""))

This formula is a multi-worksheet averaging of numbers given specific criteria.
A4:A22 refers to the names of the worksheets. In this case Week 1, Week 2, Week 3…, Week 19.
B123:K123 refers to the final line on each of the worksheets,which is an average of rows 7 – 122.
B4:K4 is a criteria reference; in this case it refers to a specific state.
B5:K5 is also a criteria reference; referring to a product type.
B4 refers to the specific state I want the formula to search for in B4:K4
Q9 refers to the specific product type I want the formula to search for in B5:K5.

The formula works fine in that it successfully searches through all the worksheets, finds the task and state match and averages the results. If there is only one instance of the state/task, it returns the one result. If there are no matches, it leaves the cell blank.

The problem with this formula is that if I need to add or remove a row above line 123, the B123:K123 reference does not automatically update to reflect the removal or addition of the new row. In order to save myself some time if I make a change, I would love to be able to find a way to make this formula update on its own.
Any help or assistance you could provide would be greatly appreciated!

Last edited:

yky

Well-known Member
Excel doesn't change anything inside double quotation marks. Try this:

INDIRECT("'"&\$A\$4:\$A\$22&"'!B" & ROW(B123) & ":K" & ROW(K123))

1,078,435
Messages
5,340,261
Members
399,361
Latest member
Linford

This Week's Hot Topics

• Problem with Radio Button's format control
I am creating an employee evaluation template (a sample is below) Column A is the category Column B, C D, E and F will be ratings (unacceptable...
• Last Display on userform to a Listbox
[CODE=vba] lstdisplay.ColumnCount = 15 lstdisplay.RowSource = "A1:O600000" [/CODE] So when i do this it Displays everything on the sheet i am...
• Rename and move files to a new location
Dear all, I have an excel file with the following information. The actual file name is at column A but i want to rename it using the following...
• Help with True/False Formula
Hello! Am stumped how to fix this formula, in which my result returns 'True', but it should return False. =IF(AG2=True...
• Clear extra characters from a provided range of cells
Dear All, I have following code which gives me desired output to remove extra characters from a provided range. But it takes too much time when...
• Help with Current and highest streaks
Hi there, I've just joined the forum and this is my first post. I've already spent quite a bit of time searching the net and this forum for a...