Is there a faster way to get the max length of strings stored in an array besides looping through each item in the array and checking the length?
Is there a faster way to get the max length of strings stored in an array besides looping through each item in the array and checking the length?
Last edited by yawnzzzz; 07-20-2010 at 05:27 PM.
I don't think so, but as long as the array is in memory, the complete loop would be near-on instantaneous.
_________________
Microsoft MVP 2010 - Excel
Visit: Jerry Beaucaire's Excel Files & Macros
If you've been given good help, use theicon below to give reputation feedback, it is appreciated.
Always put your code between code tags. [CODE] your code here [/CODE]
?None of us is as good as all of us? - Ray Kroc
?Actually, I *am* a rocket scientist.? - JB (little ones count!)
If your array is a range, e.g. A1:D8
![]()
Please Login or Register to view this content.
I get error 2036 for c02.
A1:D8 all contain characters ?
Nothing further, your honour...
See the attachment.
Afraid my example is not a range.
Why don't you tell us what kind of array it is ?
You'll need to loop I think, assuming you can't track it when populating the array initially.
Everyone who confuses correlation and causation ends up dead.
I'm already tracking it when populating the array initially, so it sounds like that might be my best bet. I'm just dealing with the potential to have such a large amount of data that I'm looking for anything that might run just a fraction of a second faster.
My sample I used an entire column, so A:A won't work in this syntax, but I'm still very happy to see this [....] syntax that appears to allow standard worksheet formula verbiage. Very useful.
It's just a shorthand notation for the Evaluate function, JB. In common usage, it serves to add a function where none is needed.
Entia non sunt multiplicanda sine necessitate
It's also slower than Evaluate, FWIW.
Run this:
![]()
Please Login or Register to view this content.
Last edited by shg; 07-20-2010 at 06:07 PM.
I thought this line was on maxlength in an array ?
![]()
Please Login or Register to view this content.
Last edited by snb; 07-21-2010 at 05:51 AM.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks