Hi, first post on this site for me!
I have created a useful and what I think is user-friendly search facility so a user can try and locate the correct item, but I am wondering if there is a more elegant means to do the same using less cell formula and purely VBA (at the moment it is a mix).
I have tried a VBA approach previously (but I think it was a little clumsy) and resulted in a very long time to calculate in comparison to my more functional approach where a result is near-instant, but involves much more cell formula instead.
About the file:
- The list of over 7000 items has 5 fields (columns), order code, other number, long and short descriptions etc.
- The user inputs text to search for an item e.g. "pipe motor ABC" (that's 3 search terms)
- The user can choose which of the fields to search using 5 check boxes.
- For each item in the 7000, a concatenated string is calculated for all the selected fields.
- VBA code splits the users search into words (search terms, maximum of 10).
- Using search() I have a 10x7000 cell range that checks whether each word is in the concatenated data for that item/row.
- Each item in the 7000 then has a sum cell where the result of how many of the search terms are included in the selected fields (held in the concatenated string).
- VBA code then copies all fields of the items that match the criteria, starting with those with the highest value of matches in the selected fields.
In the current format as I say, it calculates instantly which I think is quite good - the only downfall is increased file size compared to more VBA code...? and more cells to protect the user from editing!
I have also easily included added flexibility for searching, like all uppercase words MUST be included in matched items and to only return results that have a minimum of X search terms included, and match all search terms.
Umm, hopefully you can sort of understand that? I'm sure there must be an easy efficient and fast way of doing this, perhaps though it's using Access instead?
My general approach is to get something that is functional, but it is usually by no means the best and often is revised drastically various times afterwards.
Any help of thoughts would be greatly appreciated.
Jo
Bookmarks