View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Harlan Grove
 
Posts: n/a
Default Using Column in Sumproduct

PeterW wrote...
When I check the below formula it seems to fall over because of the use
of the Column function.

=SUMPRODUCT((OFFSET(mod_Records_Filtered_AccountC odeCol,1,,43,)
=CashFlow_Primary!$E12)*(OFFSET(mod_Records_Filte red_AccountCodeCol,1,
COLUMN(Records_Filtered!AC$1)-COLUMN(mod_Records_Filtered_AccountCodeCol),43,)))

Is it possible to use the Column function with Sumproduct??

....

You're correct that this formula fails is due to the COLUMN function
call. The reason is that COLUMN *always* returns an array (as does ROW)
even when returning a single value. To demonstrate, type =COLUMN(A1)
and press [F9] rather than [Enter]. The result in the formula bar will
be ={1}, not =1. When you pass OFFSET arrays, even single value arrays,
as 2nd or 3rd arguments, OFFSET returns an undocumented results that
functions like an array of range references. Entered directly in an
cell range, Excel would evaluate such formulas as expected, but used as
subexpressions in more complicated formulas they won't work.

The answer is converting the COLUMN subexpression into a true scalar
(single value nonarray), and the easiest way to do that is using SUM.
So try

=SUMPRODUCT(--(OFFSET(mod_Records_Filtered_AccountCodeCol,1,,43, )
=CashFlow_Primary!$E12),OFFSET(mod_Records_Filtere d_AccountCodeCol,1,
SUM(COLUMN(Records_Filtered!AC$1)
-COLUMN(mod_Records_Filtered_AccountCodeCol)),43,))