Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default Formula for neg and pos values

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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
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?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 510
Default Formula for neg and pos values

Hi

What do you want to be returned, and what do you get instead?

For me, when max value in range is p.e. 3 and minimum value -4, your formula
returns 7 - which is right answer, because biggest number is 3 and smallest
is -4.
Maybe you wnt to compare absolute values?
=MAX(ABS(A1:A10))-MIN(ABS(A1:A10))

--
When sending mail, use address arvil<attarkon.ee
Arvi Laanemets


"Paul" wrote in message
...
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?



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Formula for neg and pos values

If you have
-5
-4
-3
-2
-1
0
1
2
3
4

In A1:A10, the minimum is -5. The maximum is 4.
Maximum-minimum = 4 - -5 = 9.

What do you really want?

If you're looking for the maximum positive number, you can use something like:

=IF(COUNTIF(A1:A10,"0")=0,"No Positive numbers",MAX(IF(A1:A100,A1:A10)))

This is an array formula. Hit ctrl-shift-enter instead of enter. If you do it
correctly, excel will wrap curly brackets {} around your formula. (don't type
them yourself.)


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?


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default Formula for neg and pos values

I stand corrected - thanks - just did not know it worked
that way

-----Original Message-----
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?

.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Formula for transposing Row Values to Col Values Ken Excel Discussion (Misc queries) 1 April 14th 10 02:55 PM
Show and copy values in formula bar containing a formula Timbo Excel Discussion (Misc queries) 2 April 15th 08 10:42 PM
Build excel formula using field values as text in the formula val kilbane Excel Worksheet Functions 2 April 18th 07 01:52 PM
copy values generated by conditional formula in one sheet to the other work sheet as values ramana Excel Worksheet Functions 1 October 5th 05 01:04 PM
copy values generated by conditional formula in one sheet to the other work sheet as values bobby Excel Discussion (Misc queries) 1 October 5th 05 12:18 PM


All times are GMT +1. The time now is 03:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"