LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default Best ways to search an array/collection for an element

Ciao, Rick,

thanks for the links, I've checked them out and it looks like I'd
better give up using arrays in favour of dictionaries. I wonder if
there could be some overhead in using dictionaries instead than arrays
coupled with a FindElementInArray function: I have no idea because
I've never heard of dictionaries until now. What do you think? Would
it make sense to always use a dictionary when I need a resizable data
structure which must be often searched for a particular element?

I'm surprised I've never heard of similar structures in other
(admittedly older) languages. Is this maybe characteristic of Object
Oriented Programming? Or it's just me being ignorant? :)

Best Regards

Sergio Rossi

On 12 Feb, 19:04, "Rick Rothstein"
wrote:
The Dictionary object is like a Collection object on steroids. You can do a
Google search for...

vb "dictionary object"

to find out more, but here is a link to get you started...

http://support.microsoft.com/kb/187234

--
Rick (MVP - Excel)

"deltaquattro" wrote in message

...
Hi Bernie,

I'll try it - what's a dictionary? Couldn't find it in the book by
Walkenbach.

Thnx,

Best Regards

Sergio

On 12 Feb, 18:14, "Bernie Deitrick" <deitbe @ consumer dot org wrote:



For 2D non-numeric arrays, try either a dictionary object - great if you
are
loading a large file. Lots of samples available.


HTH,
Bernie
MS Excel MVP


"deltaquattro" wrote in message


...


Hi guys!


I'm creating a small library of utilities for VBA programming, and
right now I'm completing my ArrayManagement and CollectionManagement
module. I was considering different solutions for the classical case
of searchin an array or collection for a specified elements. So far
I've considered using Worksheetfunction.VLOOKUP,
Worksheetfunction.Match (needs some care to take into account the
"element not found" case) for the arrays. I also developed an handy
binary search function for sorted arrays, but it works only for 1D
numeric arrays (sorted in either nonincreasing or nondecreasing order)
but I have no idea on how to extend it multiD/non numeric arrays (if
that's possible at all). Also, I would like to find some smart "Is
Nothing"-based trick for searching in a collection. and Any
suggestion/alternatives? Thanks,


Best Regards


deltaquattro


ps if anybody is interested, I can post my "rough" attempts at a
solution.




 
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
Matching/Finding/Search Array Element [email protected] Excel Programming 8 May 9th 09 10:53 PM
Rules for element-by-element product in array multiplication Paul Excel Programming 2 March 22nd 08 11:42 PM
delete element is collection Gary Keramidas Excel Programming 3 November 14th 07 10:48 PM
Search array and return element No Ron Excel Worksheet Functions 7 May 17th 06 05:27 AM
Array problem: Key words-Variant Array, single-element, type mismatch error davidm Excel Programming 1 November 8th 05 04:21 AM


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