Hi,

I have three columns: A and B with a value.

In column C we have indicated A, B or 0, making reference to the first column (A), or the second column (B), or neither (0).

In column D I would like the result of add or subtract the values of A and B, depending of what is on column C.

The column C marks which column has to be sum and wich one has to be subtract:

if in column C is A, I look for the result of +A-B.

3 5 A -2

if in column C we have B, the result of -A+B.

3 5 B +2

And if in column C we have 0", the result of -A-B/2.

3 5 0 -4

In column D we have this result, that add to the result of the previous row. For example, in the next serie:

3 5 B 2

2 6 A -2

3 5 A -4

4 4 A -4

5 3 0 -8

4 2 A -6

In the first row we subtract 3 and add 5 (-3+5=2).

In the second row we add 2 and subtract 6 (2-6= -4). Because we had 2 as result in the previous row, we subtract 4 to 2 (2-4= -2)

In the third row we subtract 5 to 3 (3-5= -2), and this we subtract to -2 (-2-2=-4), and this gives us the result in column D.

In the fourth row we have 4-4 = 0. The result of the previous row doesnt change.

In the fifth row we have in column C 0", then we have to subtract both values, and calculate the half: (-5-3/2=-4), and this subtract to the previous value in column D (-4 -4= -8).

I attached an example worksheet to make it clearer.

Thank you very much,

Caldera55

## Bookmarks