sum positive and negative values

B

bora

Hi, I am looking for a vba routine
I have a time series like this:

1995, -.05
1996, -2.1
1997, 3.6
1998, 4.3
1999, 0.7
2000, -0.08
2001, -0.1

and I would like to sum just the positive and negative value separately
in this way

1995, -2.15
1996, 8.6
1999, -0.18
i.e the sum of negative or positive values should be associated to the
last date of the previous growth or drop. I don't know in advance the
length of period of drop and growth

Thanks in advance.
 
B

bora

in the column A I have the year
in the column B I have the annual (growth or decrease) rate of output

in 1995 I would have the sum of B1+B2 because it is the first data
in 1996 that is the las year of drop, I would like the sum of B3+B4+B5
in 1999 that is the las year of growth I would like the sum ob B7+B7

the length of drop or growth is unknown because in another country i
could have:

1995, -.05
1996, 3.1
1997, 4.3
1998, 1.1
1999, 0.7
2000, -1.08
2001, -2.1

and then
1995, -.05 (because I don't have previous years)
1995, 9.3 (problem)
1999,-2.18

In order to avoid confusion It is better to me to have two routines
separated for negative and positive values respectively
 

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