Finding value in Array

Rasm

Well-known Member
Joined
Feb 9, 2011
Messages
505
I have an array of strings (the strings are not on any sheet - just in a dynamic array - the array is dimmed as say i.e. "Dim MyString(20,5) as string" - I would like the match to be exact - so If I search for "Test" - and I have a value "Test" & "Test123" - I would like to only get the Index for "Test" - Ideally I would like my index to be say 5,3 if Mystring(5,3)="Test".
 
Shg - Just tried Mike's way - using the nested loop -

I think you may be right about match being too slow.

I will try your method now

Thanks - for the help guys.
 
Upvote 0

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
It's hugely slow. FindVal1 uses Match and FindVal2 uses nested loops.
 
Upvote 0

Forum statistics

Threads
1,225,156
Messages
6,183,246
Members
453,152
Latest member
ChrisMd

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top