INDIRECT will not work with a dynamic named range. You could define a new name using EVALUATE(somecell) where somecell is the cell that contains "_Pub" (without quotes) and then use that name in the formula. You could also use worksheet level names instead and point them to the relevant ranges.
Including a named range as a cell reference within a nested SUMPRODUCT, SUMIF, INDIRECT Function
I am using these nested formulas to sum data from several sheets.
This formula works perfectly:
=SUMPRODUCT(SUMIF(INDIRECT("'"&_Pub&"'!A:A"),$A9,INDIRECT("'"&_Pub&"'!"&AE$6)))
_Pub is a workbook level dynamic named range of a list of several sheets. I would like to replace _Pub with a cell reference (AE5) and include the named range _Pub in cell AE5. I have multiple summary and detail sheets within a given workbook and the named range is different for each summary sheet. It is easier to copy and paste the formula if I could use a cell reference of the named range rather than hardcoding the named range in the formula. However when I change the formula to this:
=SUMPRODUCT(SUMIF(INDIRECT("'"&AE$5&"'!A:A"),$A9,INDIRECT("'"&_Pub&"'!"&AE$6)))
The result is #REF
Any ideas?
Microsoft 365 and Office | Excel | For home | Windows
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
4 answers
Sort by: Most helpful
-
-
Ashish Mathur 100.9K Reputation points Volunteer Moderator2015-03-26T00:08:25+00:00 Hi,
Try this (untested)
=SUMPRODUCT(SUMIF(INDIRECT("'"&INDIRECT(AE$5)&"'!A:A"),$A9,INDIRECT("'"&_Pub&"'!"&AE$6)))
-
Anonymous
2015-03-26T11:01:09+00:00 Thank you unfortunately this didn't work.
-
Anonymous
2015-03-26T11:03:31+00:00 Thank you. I couldn't quite understand your suggestion and have gone a different route instead.