ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   nth element extract (https://www.excelbanter.com/excel-worksheet-functions/152760-nth-element-extract.html)

RSCARLISLE

nth element extract
 
How do I extract the nth element of a string that contains no separators? I
can find plenty of VB routines doing this, however all of them require some
sort of separator. I want to be able to take a 10 to 15 digit alphanumeric
string and identify each character position and read the charater in that
position (including using * as a wild card).

John Bundy

nth element extract
 
not sure what you are trying to do, get something in the 7th position
everytime? or do you want to know the location of a certain character? the
first would be
=MID(B1,7,1)
The second would be
=FIND(A1,B1)
A1 containing what you are looking for, B1 what you are looking in this will
only show the first location found.
If neither of these then please be more specific.

--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"RSCARLISLE" wrote:

How do I extract the nth element of a string that contains no separators? I
can find plenty of VB routines doing this, however all of them require some
sort of separator. I want to be able to take a 10 to 15 digit alphanumeric
string and identify each character position and read the charater in that
position (including using * as a wild card).


[email protected]

nth element extract
 
On 2 Aug, 14:00, RSCARLISLE
wrote:
How do I extract the nth element of a string that contains no separators? I
can find plenty of VB routines doing this, however all of them require some
sort of separator. I want to be able to take a 10 to 15 digit alphanumeric
string and identify each character position and read the charater in that
position (including using * as a wild card).


the MID function would do this, although I'm not sure what you are
getting at with the * as wild card

for instance

dim MyStr as string
MyStr="test example"
dim looper as long
for looper=1 to len(mystr)
msgbox mid(mystr,looper,1)
next


will display one character at a time from the MyStr string


RSCARLISLE

nth element extract
 
John,
Stupid me- the mid function works.

Thanks,
Steve

"John Bundy" wrote:

not sure what you are trying to do, get something in the 7th position
everytime? or do you want to know the location of a certain character? the
first would be
=MID(B1,7,1)
The second would be
=FIND(A1,B1)
A1 containing what you are looking for, B1 what you are looking in this will
only show the first location found.
If neither of these then please be more specific.

--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"RSCARLISLE" wrote:

How do I extract the nth element of a string that contains no separators? I
can find plenty of VB routines doing this, however all of them require some
sort of separator. I want to be able to take a 10 to 15 digit alphanumeric
string and identify each character position and read the charater in that
position (including using * as a wild card).



All times are GMT +1. The time now is 11:48 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com