Matching/Finding/Search Array Element
For a completely generic text string (like you posted), any search method
will find the "2" in "F26" before it will find the "2" in 28038.66^35. In
order to be able to differentiate between the two "2"'s, there would have to
be some kind of "positional pattern" to the characters in the text string.
Perhaps if you gave us real example text strings to look at, instead of such
a random example one, then perhaps we will be able to discern (or ask you
for clarification) an underlying pattern upon which search code can be
built.
--
Rick (MVP - Excel)
wrote in message
...
2003, 2007
37
|
CheckStr = "-9'Min. Int.'!F26-'Min.-7
Int.'!F31+28038.66^35+[C:\123]'Clos-6ing'!E3^1"
(BTW, the string above does not make any sense in its current form - just
to test)
Data Table produced a previous Sub() above string
ConstOnly: 9 StartPosInStr: 2 StrLength: 1
ConstOnly: 7 StartPosInStr: 25 StrLength: 1
ConstOnly: 28038.66 StartPosInStr: 37 StrLength: 8
ConstOnly: 35 StartPosInStr: 46 StrLength: 2
ConstOnly: 1 StartPosInStr: 72 StrLength: 1
myArr() table is as follows:
myArr(1,1) = 9 myArr(1,2) = 2 myArr(1,3) = 1
myArr(2,1) = 7 myArr(2,2) = 25 myArr(2,3) =
1
myArr(3,1) = 28038.66 myArr(3,2) = 37 myArr(3,3) = 8
myArr(4,1) = 35 myArr(4,2) = 46 myArr(4,3) =
2
myArr(5,1) = 1 myArr(5,2) = 72 myArr(5,3) =
1
What is the quickest/smartest Array Matching/Finding/Search? To
ascertain:
Givens: TestChar = "2" Its position in CheckStr = 37
IF (TestChar's "2" ; StartPosInStr = 37) = myArr(x,2) Then
TestCharValid = True
Else
TestCharValid = False
End if
In short, is it best to do an Array loop Then:
IF (TestChar's "2" ; StartPosInStr = 37) = myArr(3,2) Then
TestCharValid = True
Else
TestCharValid = False
End if
Or
Is there an array search function which can directly VLookup? all
Array(2,x)??
TIA EagleOne
|