View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
David David is offline
external usenet poster
 
Posts: 1,560
Default Formula for neg and pos values

The formula works for me. This is Cols A,B,C, with formulas at bottom for
Max, Min and Delta( diff between Max and Min). Maybe this is not what you
want?
1 -1 1
2 -2 2
3 -3 3
4 -4 4
5 -5 5
-1 -1 1
-2 -2 2
-3 -3 3
-4 -4 4
-5 -5 5

Delta 10 4 4
Max 5 -1 5
Min -5 -5 1


"Paul" wrote:

I have a range of cells (A1:A10) that sometime contain
only positive values, sometime contain all negative
values, and sometime contain both positive and negative
values.

I need the valued of the difference between the maximum
and minimum values; but MAX(A1:A10)-MIN(A1:A10) only works
when min is equal or greater than zero.

Is there a formula in Excel or VBA that returns the
correct difference between the maximum and minimum even
when there are negative vlues in the range of values?