LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default Finding the maximum in an array of strings (Excel VBA)

On 24 Nov, 20:18, joeu2004 wrote:
On Nov 24, wrote:

as stated in the object, I need to find the maximum in an array of
strings, using VBA in Excel 2000. Of course I could use a (slooow)
linear search

[....]
I tried to use LOOKUP, but it doesn't work, since it expects the
array to be in ascending order, which of cours isn't the case,
otherwise I wouldn't need to LOOKUP at all (I'd just pick the first
element of the array).


I interpret that to mean that the array is not ordered at all, even in
descending order.

In that case, you must use a linear search to find the max or min of
anything.

VLOOKUP and HLOOKUP can do linear searches, as can MATCH. *Whether or
not they are faster than a VBA implementation, I cannot say with
impunity.

It might depend, in part, on what you want to find the max of. *String
comparisons? *Longest string? *Something else?


Hi,

you're perfectly right, the array is not ordered in any sense. My max
is defined in the sense of String comparison: I mean that for me,

"013" < "023"

and

"A03" "003"

in accordance to the Strcomp function.

Thanks,

Sergio
 
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 Maximum of Two Numbers in Array cardan Excel Programming 2 January 22nd 08 11:06 PM
What is the maximum number of unique strings in Excel 2003 [email protected] Excel Programming 5 October 31st 07 01:43 PM
Finding Location of Maximum Value in 2D Array [email protected] Excel Discussion (Misc queries) 17 November 10th 06 02:36 PM
Finding Location of Maximum Value in 2D Array [email protected] New Users to Excel 15 November 9th 06 05:23 AM
Finding Location of Maximum Value in 2D Array [email protected] Excel Worksheet Functions 15 November 9th 06 05:23 AM


All times are GMT +1. The time now is 09:39 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"