View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Rosenfeld[_2_] Ron Rosenfeld[_2_] is offline
external usenet poster
 
Posts: 1,045
Default How to sum x cells that are greater than zero on the right?

On Fri, 8 Apr 2011 10:32:59 -0700 (PDT), Learn wrote:

Hi

I am finding a solution (formula) to automatically sum (3 or 12) cells
on the right after encountering first right cell greater than 0.

Currently, this is done manually. (eg. 3.8 is the sum of 2.9 (Aug) +
0.5 (Sep) + 0.4 (Oct).)

Question is there a way to do this automatically because there are
thousands of rows..and this will drive me crasy in maintaining this
worksheet effectively. Thanks.

First First
3M 12M Jul Aug Sep Oct Nov
Dec ....................
---------------------------------------------------------------------------
----------------------------------------------------------------
3.8 5.4 0.0 2.9 0.5 0.4 0.3
0.2 ....................
1.1 2.2 0.0 0.9 0.0 0.2 0.0
0.4 ....................
0.0 0.0 0.0 0.0 0.0 0.0 0.0
0.0 ....................
4.1 5.2 0.0 0.0 0.0 1.9 1.3
0.9 ....................
3.1 5.1 0.0 0.0 0.0 0.5 1.7
0.9 ....................
2.6 3.9 0.0 0.0 0.0 0.4 1.1
1.1 ....................

Thanks.


Unless the data you have posted is incomplete, I don't understand your values for the First 12M, but the following formula should work.

This assumes that your actual First Month is in Column C; adjust as required:

3M:

A4: =IF(COUNTIF($C4:$Z4,"0"),SUMPRODUCT(OFFSET($B4,0, MATCH(TRUE,$C4:$Z40,0),1,3)),0)

12M:

B4: =IF(COUNTIF($C4:$Z4,"0"),SUMPRODUCT(OFFSET($B4,0, MATCH(TRUE,$C4:$Z40,0),1,12)),0)