Solved

# Use calculated row number in a sumproduct reference

Posted on 2016-09-14

I have a vary awkward data source from which I need to calculate 888 averages that use a sumproduct formulas making it painfully slow. I would therefore like to at least limit the size of the array but each time the data is updated the number of rows and columns change. It is easy enough to use a formula to calculate the bottom row number and right-most column number but how would I reference those in my sumproduct? E.g. say cell A1 contains the number of rows and c1 contains the number of columns. How would I modify the following formula to change row 2000 to A1 and column LY to cell C1 contents?

=SUMPRODUCT((MasterData!$F$1:$LY$1=B$6)*(MasterData!$A$6:$A$2000=SiteId&TEXT($A8,"00"))*MasterData!$F$6:$LY$2000)/SUMPRODUCT((MasterData!$F$1:$LY$1=B$6)*(