Thread: Tricky Formula
View Single Post
  #11   Report Post  
Posted to microsoft.public.excel.misc
Fingerjob Fingerjob is offline
external usenet poster
 
Posts: 26
Default Tricky Formula

The best formula would be this one:

=IF(A2<=0;0;MAX(0;SUM($A$1:A2)-SUM(B$1:$B1)))

Put it in B2 and drag it down.

skrev:

Hi Andrew,

If your desired output for this input:
-1%
-1%
1%
-2%
-2%
6%
-1%
-1%
7%
would be:
0%
0%
0%
0%
0%
1%
0%
0%
5%
then enter into cells B1:C2 (normal, NOT array-entered):
=MIN(0,A1) =MAX(0,A1)
=MIN(0,A2+B1) =MAX(0,A2+B1)
and copy B2:C2 down as far as necessary.

HTH,
Bernd