mapsamountainrange
New Member
- Joined
- Jun 4, 2018
- Messages
- 4
So I'm using a SumProduct array to sum values from an input sheet if they match both a row label (month) and a column label. This has been working well, but now I'm trying to expand it to sum if it matches either of two column labels. Here's the original formula:
The first row of that matches the row labels, the second row matches the column header, and the third row returns the actual values to be summed.
But if I expand the formula to:
It returns all values that match the month row, even columns that don't match either of those criteria. Each will work individually, but not in that OR(). I would just add the two together, but the formula needs to be able to be updated by a macro, and the addition version is too long and gives me a "1004, Unable to set the FormulaArray property of Range Class" error.
Any thoughts?
Code:
=SUMPRODUCT(NOT(ISERROR(SEARCH($A10,'Input Sheet'!$A$18:$A$29)))
*NOT(ISERROR(SEARCH("Billed Peak kW",'Input Sheet'!$B$17:$U$17)))
*IF(ISNUMBER('Input Sheet'!$B$18:$U$29),'Input Sheet'!$B$18:$U$29,0))
The first row of that matches the row labels, the second row matches the column header, and the third row returns the actual values to be summed.
But if I expand the formula to:
Code:
=SUMPRODUCT(NOT(ISERROR(SEARCH($A10,'Input Sheet'!$A$18:$A$29)))
*OR(NOT(ISERROR(SEARCH("Billed Peak kW",'Input Sheet'!$B$17:$U$17))),NOT(ISERROR(SEARCH("Billed kW",'Input Sheet'!$B$17:$U$17))))
*IF(ISNUMBER('Input Sheet'!$B$18:$U$29),'Input Sheet'!$B$18:$U$29,0))
It returns all values that match the month row, even columns that don't match either of those criteria. Each will work individually, but not in that OR(). I would just add the two together, but the formula needs to be able to be updated by a macro, and the addition version is too long and gives me a "1004, Unable to set the FormulaArray property of Range Class" error.
Any thoughts?