View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bill[_31_] Bill[_31_] is offline
external usenet poster
 
Posts: 3
Default Offsetting losses against profits

All,

I am looking to create code that models the treatment of losses for
tax purposes.

Essentailly this means that I have a range of cells wit hvalues ,say,

-100, -70, 50, 50, 50, 50, 50, etc

THe first negative values in the series are added together and then
taken from the succeeding positive values to return zero or whatvever
is left. The results are returned in the row below.

In the above case the row below would read :

0,0,0,20, 50

so the -170 was spread over the 50, 50, 50, 50, 50.


HOw can I create a construct that has a running sun, so to speak and
can retuen the above.

I tried with formulae but could not get it to work when the negative
values wer eintersperced throughout the series.

I imaging it willl have to be an if....then construct.


Any ideas

Many thanks