View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.newusers
Stan Brown Stan Brown is offline
external usenet poster
 
Posts: 524
Default Caculating the remainding amount

On Sat, 28 Jan 2012 11:11:21 +0000, bob__ wrote:

A has an amount which could be negative or positive.
B always starts with 3000 (could be 4000 or anything else later on, but
for all purposes 3000 is fine)

Is there a way so that if A is ever a negative, i can have an amount
taken from B to bring A back to zero.

If A is positive, nothing would be done, but if A was -345.32 for
example, that exact amount is taken from B


In B1:

=3000+min(0,A1)

If A1 is negative, min(0,A1) is A1, and that negative amount will be
added to B1, or in other words B1 will be reduced.

If A1 is positive (or 0), min(0,A1) is 0, an dB1 will be 3000.

--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com
Shikata ga nai...