View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Matching/Finding/Search Array Element

I don't think I am completely following how you have things setup, but
perhaps the following will help you out. You can find out what character is
located at any specified position in a text string by using the Mid
function...

Dim Character As String
Character = Mid(YourTextString, StartPosition, 1)

The 1 in the third argument is because we are looking for a single
character, but the number there is the number of characters to retrieve
starting from the StartPosition specified in the second argument. So, if you
wanted the single character appearing at position 25 in the example text
string you posted, then this would give it to you...

Character = Mid(CheckStr, 25, 1)

On the other hand, if you wanted the 8 characters starting from position 25
of the string (that would be the 28038.66), you would do this...

Characters = Mid(CheckStr, 25, 8)

--
Rick (MVP - Excel)


wrote in message
...
Thanks Rick.

My question is:

If I already know that the "2" (I want) is in Position 37 of CheckStr,

but I want to confirm that it is found/exists in myArr(x,2);
(As per my data table i.e.: 2,25,37,46,72)

How do I do that?



"Rick Rothstein" wrote:

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.