View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
T. Valko T. Valko is offline
external usenet poster
 
Posts: 15,768
Default subtraction of negative numbers

So, if *either* number is negative then the result should be negative?

Try this array formula** :

=IF(COUNTIF(A1:B1,"<0"),-SUM(ABS(A1:B1)),A1+B1)

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER)

Or, normally enter this slightly longer version:

=IF(COUNTIF(A1:B1,"<0"),-SUM(ABS(A1),ABS(B1)),A1+B1)

--
Biff
Microsoft Excel MVP


"Roger" wrote in message
...
I'm trying to create an equation that, on occation, will result in a
subtraction of a negative, which then results in a larger negative number
than it should be.

So for example:

=sum(A1 - B1)
A1 = -50
B1 = 40

so the results of this equation is -90, but in reality it should be -10.

seems simple but it's confusing the hell out of me.

thanks in advance for the help.
roger