View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Biff Biff is offline
external usenet poster
 
Posts: 1,688
Default Trouble with SUMPRODUCT

"edwardpestian"
wrote in message
news:edwardpestian.2aemhd_1151988602.9131@excelfor um-nospam.com...

Something strange is happening. When I move one column to the right.
In order to sum the second column in the range, its summing the entire
range instead of the dates up to and including the date in cell CY2.

=SUMPRODUCT(--(MOD(COLUMN($F5:$CO5),3)=1),--($F$3:$CO$3<=$CY$2),$F5:$CO5)


That's because of your merged cells. Moving one column to the right (by
changing the MOD to = 1), now the formula is referring to G5:CO5 and G3:CO3.
G3 and all cells in row 3 within the range that meet the MOD condition are
empty and those cells evaluate to 0 and 0 <= CY2. Even though G3 is merged
with F3 and H3 it can still be referenced as a separate cell. Only the top
left cell in a merged group contains the value.

You can try this:

=SUMPRODUCT(--(MOD(COLUMN($F5:$CO5),3)=1),--(OFFSET(F3:CO3,,-1)<=CY2),$F5:$CO5)

Personally, I would unmerge the cells and put dates in all cells of the date
row. Merged cells usually do nothing but cause problems!

Biff