Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default get max or min number

i have these numbers
-3
2
1

i want the maximum absolute number but i want to retain the sign afterwards.
So i put =MAX(ABS(G81:I81))
but that returns 3 and not -3
how do i tell the formula to also return the correct sign of the maximum
absolute number in a range of numbers?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,124
Default get max or min number

try this array entered formula
=MAX(IF(ABS(E2:E4)0,ABS(E2:E4)))

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Karish" wrote in message
...
i have these numbers
-3
2
1

i want the maximum absolute number but i want to retain the sign
afterwards.
So i put =MAX(ABS(G81:I81))
but that returns 3 and not -3
how do i tell the formula to also return the correct sign of the maximum
absolute number in a range of numbers?


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,268
Default get max or min number

One way

=INDEX(G81:I81,MATCH(MAX(ABS(G81:I81)),ABS(G81:I81 ),0))

entered with ctrl + shift & enter



--


Regards,


Peo Sjoblom




"Karish" wrote in message
...
i have these numbers
-3
2
1

i want the maximum absolute number but i want to retain the sign
afterwards.
So i put =MAX(ABS(G81:I81))
but that returns 3 and not -3
how do i tell the formula to also return the correct sign of the maximum
absolute number in a range of numbers?



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,856
Default get max or min number

Here's one way:

=IF(MAX(G81:I81)<MAX(ABS(G81:I81)),-1,1)*MAX(ABS(G81:I81))

Hope this helps.

Pete

On Oct 24, 11:08 pm, Karish wrote:
i have these numbers
-3
2
1

i want the maximum absolute number but i want to retain the sign afterwards.
So i put =MAX(ABS(G81:I81))
but that returns 3 and not -3
how do i tell the formula to also return the correct sign of the maximum
absolute number in a range of numbers?



  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 527
Default get max or min number

Array entered Ctrl + Shift + Enter

=IF(MAX(C1:C6)=MAX(ABS(C1:C6)),MAX(C1:C6),MAX(ABS( C1:C6))*-1)

Regards
Peter

"Karish" wrote:

i have these numbers
-3
2
1

i want the maximum absolute number but i want to retain the sign afterwards.
So i put =MAX(ABS(G81:I81))
but that returns 3 and not -3
how do i tell the formula to also return the correct sign of the maximum
absolute number in a range of numbers?



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,202
Default get max or min number

Array enter (Ctrl+Shift+Enter) this formula...

=SIGN(G81:I81)*MAX(ABS(G81:I81))

Rick


"Karish" wrote in message
...
i have these numbers
-3
2
1

i want the maximum absolute number but i want to retain the sign
afterwards.
So i put =MAX(ABS(G81:I81))
but that returns 3 and not -3
how do i tell the formula to also return the correct sign of the maximum
absolute number in a range of numbers?


  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,202
Default get max or min number

Array enter (Ctrl+Shift+Enter) this formula...

=SIGN(G81:I81)*MAX(ABS(G81:I81))


Never mind... it doesn't work... my sample data was fooling me.

Rick
  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,202
Default get max or min number

If you want a non-array entered solution, this formula will do that...

=SIGN(ABS(MAX(G81:I81))-ABS(MIN(G81:I81)))*(ABS(MAX(G81:I81))+ABS(MIN(G81: I81))+ABS(ABS(MAX(G81:I81))-ABS(MIN(G81:I81))))/2

Rick


"Karish" wrote in message
...
i have these numbers
-3
2
1

i want the maximum absolute number but i want to retain the sign
afterwards.
So i put =MAX(ABS(G81:I81))
but that returns 3 and not -3
how do i tell the formula to also return the correct sign of the maximum
absolute number in a range of numbers?


  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,202
Default get max or min number

If you want a non-array entered solution, this formula will do that...

=SIGN(ABS(MAX(G81:I81))-ABS(MIN(G81:I81)))*(ABS(MAX(G81:I81))+ABS(MIN(G81: I81))+ABS(ABS(MAX(G81:I81))-ABS(MIN(G81:I81))))/2

Rick


And, of course, it returns a wrong answer if the largest and smallest values
have the same absolute magnitude. We can patch it like this, I guess...

=SIGN(0.000000000000001+ABS(MAX(A1:A3))-ABS(MIN(A1:A3)))*(ABS(MAX(A1:A3))+ABS(MIN(A1:A3))+ ABS(ABS(MAX(A1:A3))-ABS(MIN(A1:A3))))/2

Depending on the size of the numbers being compared, we might be able to
make that constant shorter (for example, if the values being compared are
integers, then the constant could be 0.1). The above formula favors the
positive value when the extremes have the same magnitude.

Rick

  #10   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,202
Default get max or min number

Okay, ignore all my other attempts... even though the last modification I
posted will work, there is a much simpler and more straightforward formula
to do what you want. This non-array, normally entered formula should do the
trick...

=IF(ABS(MIN(G81:I81))ABS(MAX(G81:I81)),MIN(G81:I8 1),MAX(G81:I81))

(See what a little rest period can do for the thinking processes.<g)

As with my other formula, this one returns the positive value if there is a
tie in magnitude between the largest negative and positive values.

Rick


"Karish" wrote in message
...
i have these numbers
-3
2
1

i want the maximum absolute number but i want to retain the sign
afterwards.
So i put =MAX(ABS(G81:I81))
but that returns 3 and not -3
how do i tell the formula to also return the correct sign of the maximum
absolute number in a range of numbers?


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
countif formula to find the occurances of a number that is greater than one number but less than another steveo Excel Discussion (Misc queries) 3 July 8th 06 02:04 AM
convert text-format number to number in excel 2000%3f Larry Excel Discussion (Misc queries) 1 July 29th 05 08:18 PM
Count number of times a specific number is displayed in a cell ran subs Excel Worksheet Functions 1 June 27th 05 05:01 PM
excel format cells/Number/Category: Number problem Matts Excel Discussion (Misc queries) 5 December 9th 04 09:47 PM
Rounding a number to a multiple quantity that adds to a fixed total number wjlo Excel Worksheet Functions 1 November 9th 04 04:43 PM


All times are GMT +1. The time now is 07:39 AM.

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

About Us

"It's about Microsoft Excel"