summing problem

M

Marcel

Dear all,

I have three columns with data:

Col A Col B Col C
1 17 0
1 17 0
2 0 17
1 16 0
1 16 0
2 0 16
2 0 50
2 0 65
2 0 77
2 0 62

Col A always contains either 1 or 2. The amount of one's and two's in
Col A can vary, as well as their order. In case of 1 in Col A the
corresponding cell in Col B is nonzero and that in Col C is zero. In
case of 2 in Col A, it is the other way around.

Col D (results) should look as follows:

Col D
0
0
51
0
0
48
50
65
77
62

Cell D3 is obtained by summing C3+B2+B1 and D6 by summing C6+B5+B4.
Apart from cells D3 and D6, all other D-cells are equal to their
corresponding C-cell.

Can this be realized with formulas ? (A VBA user function is ok too,
as long as no user intervention such as running a macro is required).

Any help is appreciated !

Thanks and greetz,
Marcel
 
F

Frank Kabel

Hi
use the following formulas:
D1:
=IF(A1=1,0,C1)

D2:
=IF(A2=1,0,SUM($B$1:C2)-SUM($D$1:D1))
and copy this formula down for all other rows
 
M

Marcel

Sehr geehrter herr Kabel, dear Frank,

I have tried your solution and it works great. Fantastic !
Very many thanks for your help.

Cheers,
Marcel Langoor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top