Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Largest value in a range

Hi all,

Is there a nice non-array formula (or a more efficient array formula) to
compute the largest value (positive or negative) in a range such as this
one:

-5, 2, 0, -2, 10, -11.

In this case the answer is -11.

I use this formula but I think there should be something better than that.

{=IF(MAX(range)=MAX(ABS(range)),MAX(range),-MAX(range)))}

Thanks for any tips.

Milos.




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Largest value in a range

Miles,

Not non-array, but simpler

=MAX(ABS(A1:A100))

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Milos Setek" wrote in message
...
Hi all,

Is there a nice non-array formula (or a more efficient array formula) to
compute the largest value (positive or negative) in a range such as this
one:

-5, 2, 0, -2, 10, -11.

In this case the answer is -11.

I use this formula but I think there should be something better than that.

{=IF(MAX(range)=MAX(ABS(range)),MAX(range),-MAX(range)))}

Thanks for any tips.

Milos.






  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Largest value in a range

Hi Bob
this was my first idea also, but this will return 11 for his example
data but the OP wants -11.
So I'm still trying to create a simpler formula - but did not
succeed....

Best regards
Frank


Bob Phillips wrote:
Miles,

Not non-array, but simpler

=MAX(ABS(A1:A100))


"Milos Setek" wrote in message
...
Hi all,

Is there a nice non-array formula (or a more efficient array
formula) to compute the largest value (positive or negative) in a
range such as this one:

-5, 2, 0, -2, 10, -11.

In this case the answer is -11.

I use this formula but I think there should be something better than
that.

{=IF(MAX(range)=MAX(ABS(range)),MAX(range),-MAX(range)))}

Thanks for any tips.

Milos.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Largest value in a range

Thank you Bob, but I want to return the negative sign, so in the example I
gave the number returned must be -11. If -11 was not there then the largest
would be 10.

Milos.

"Bob Phillips" wrote in message
...
Miles,

Not non-array, but simpler

=MAX(ABS(A1:A100))

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Milos Setek" wrote in message
...
Hi all,

Is there a nice non-array formula (or a more efficient array formula) to
compute the largest value (positive or negative) in a range such as this
one:

-5, 2, 0, -2, 10, -11.

In this case the answer is -11.

I use this formula but I think there should be something better than

that.

{=IF(MAX(range)=MAX(ABS(range)),MAX(range),-MAX(range)))}

Thanks for any tips.

Milos.








  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Largest value in a range

Hi Frank,

Missed that subtle nuance. INDEX(MATCH?

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Frank Kabel" wrote in message
...
Hi Bob
this was my first idea also, but this will return 11 for his example
data but the OP wants -11.
So I'm still trying to create a simpler formula - but did not
succeed....

Best regards
Frank


Bob Phillips wrote:
Miles,

Not non-array, but simpler

=MAX(ABS(A1:A100))


"Milos Setek" wrote in message
...
Hi all,

Is there a nice non-array formula (or a more efficient array
formula) to compute the largest value (positive or negative) in a
range such as this one:

-5, 2, 0, -2, 10, -11.

In this case the answer is -11.

I use this formula but I think there should be something better than
that.

{=IF(MAX(range)=MAX(ABS(range)),MAX(range),-MAX(range)))}

Thanks for any tips.

Milos.







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Largest value in a range

Bob Phillips wrote:
Hi Frank,

Missed that subtle nuance. INDEX(MATCH?


Yeah
I tried that but the result is even more complicated than the OP's
solution. I only got to this non array solution:
=SUMPRODUCT((ABS(range)=MAX(ABS(range)))*(range))
not simpler but a non array one :-)

Frank

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Largest value in a range

Hello again Bob and Frank,

The below formula is an array one, since I had to press ctrl+shift+enter to
get it working. However, it is clever.

The reason why I am asking this is because mine one gives me a #VALUE! error
when run from within a VBA macro, but manually it works so I am not sure
what is going on, and hence I wanted to try something either simpler or
non-array based.

Thank you all for your efforts.

Milos

"Frank Kabel" wrote in message
...
Bob Phillips wrote:
Hi Frank,

Missed that subtle nuance. INDEX(MATCH?


Yeah
I tried that but the result is even more complicated than the OP's
solution. I only got to this non array solution:
=SUMPRODUCT((ABS(range)=MAX(ABS(range)))*(range))
not simpler but a non array one :-)

Frank



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Largest value in a range

Hi Milos
you're right. It is array entered. Missed that due to my small number
of testing data
Frank

Milos Setek wrote:
Hello again Bob and Frank,

The below formula is an array one, since I had to press
ctrl+shift+enter to get it working. However, it is clever.

The reason why I am asking this is because mine one gives me a
#VALUE! error when run from within a VBA macro, but manually it works
so I am not sure what is going on, and hence I wanted to try
something either simpler or non-array based.

Thank you all for your efforts.

Milos

"Frank Kabel" wrote in message
...
Bob Phillips wrote:
Hi Frank,

Missed that subtle nuance. INDEX(MATCH?


Yeah
I tried that but the result is even more complicated than the OP's
solution. I only got to this non array solution:
=SUMPRODUCT((ABS(range)=MAX(ABS(range)))*(range))
not simpler but a non array one :-)

Frank



  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Largest value in a range

And the winner is Mayur. Thank you lots for that and it is non-array!



"Mayur" wrote in message
...
=IF(ABS(MAX(range))<ABS(MIN(range)),MIN(range),MAX (range))



  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Largest value in a range

Sumproduct is an array formula anyway, even if you don't have to array enter
it.

--
Regards,
Tom Ogilvy

Frank Kabel wrote in message
...
Hi Milos
you're right. It is array entered. Missed that due to my small number
of testing data
Frank

Milos Setek wrote:
Hello again Bob and Frank,

The below formula is an array one, since I had to press
ctrl+shift+enter to get it working. However, it is clever.

The reason why I am asking this is because mine one gives me a
#VALUE! error when run from within a VBA macro, but manually it works
so I am not sure what is going on, and hence I wanted to try
something either simpler or non-array based.

Thank you all for your efforts.

Milos

"Frank Kabel" wrote in message
...
Bob Phillips wrote:
Hi Frank,

Missed that subtle nuance. INDEX(MATCH?


Yeah
I tried that but the result is even more complicated than the OP's
solution. I only got to this non array solution:
=SUMPRODUCT((ABS(range)=MAX(ABS(range)))*(range))
not simpler but a non array one :-)

Frank





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
FInding the largest number in a range meeting a criteria Babymech Excel Discussion (Misc queries) 4 February 20th 09 09:25 PM
Largest Value in a Range Donna Excel Discussion (Misc queries) 5 October 22nd 08 10:39 PM
Can I calculate a statistical range (largest minus smallest)? lolee624 Excel Discussion (Misc queries) 2 November 14th 06 02:00 PM
Second largest value Kim Young Excel Discussion (Misc queries) 2 April 1st 05 06:19 PM
Getting the 2nd largest or smallest valuesin a range Michael Rekas Excel Discussion (Misc queries) 5 January 31st 05 07:48 AM


All times are GMT +1. The time now is 06:54 PM.

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"