text extract

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do i extract a variable length string of text from a longer string? My
cell reads "Login LDAP user mapatron at 192.168.1.146 as role student", and
would like to extract "mapatron" from this string. this username is variable
in length, so using three columns and "=right(X,X)" and "=left(X,X)" doesn't
work. any suggestions? Thanks in advance for your help.
John Supple
 
Hi John
any logic WHERE this username is lcated. e.g. always after the string
'LDAP'?
 
Hi Frank,

Yes. The username will always be followed by "Login LDAP user "username"".
The username will be of variable length, from 3 to 20 characters, the IP
address will be variable, and the role is variable - it will be one of the
following - student, staff, or faculty.

By the way, I was stationed in Hanau in 1983 and visited Frankfurt quite
often.

Thanks,
John
Oxford, MS
 
How do i extract a variable length string of text from a longer string? My
cell reads "Login LDAP user mapatron at 192.168.1.146 as role student", and
would like to extract "mapatron" from this string. this username is variable
in length, so using three columns and "=right(X,X)" and "=left(X,X)" doesn't
work. any suggestions? Thanks in advance for your help.
John Supple

If the user name always follows the word "user" and ends at a space, you could
use the formula:

=MID(TRIM(A1),FIND("user",TRIM(A1))+5,FIND(
" ",TRIM(A1),FIND("user",TRIM(A1))+5)-
FIND("user",TRIM(A1))-5)

If there is always going to be just one space between words, you can omit the
TRIM function and simplify a bit to:

=MID(A1,FIND("user",A1)+5,FIND(
" ",A1,FIND("user",A1)+5)-
FIND("user",A1)-5)


--ron
 
Hi
then try:
=MID(A1,FIND("user",A1)+5,FIND("
",A1,FIND("user",A1)+5)-FIND("user",A1)-5)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top