# Returns a numbers from a string

I have a string "115 CS 575840" that I need to return the 6 numbers that are together. So, from this string I need to return 575840.
###### Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:
Is it what your want ?

MID(yourtext,LEN(yourtext)-5,6)

Duncan
0
Process Improvement MgrCommented:
if your last numbers are always six digits you can try this:

=NUMBERVALUE(RIGHT(B3,6))

this takes the text in column B3 and takes the 6 digits from the end, and converts them to a number value
0
Commented:
this should do it

trim(mid(yourString,instrrev(yourString," ")))
0

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Author Commented:
The 6 numbers could be at the end, beginning or middle. I need to pull out the 6 no matter where they are.
0
Author Commented:
Rey, yours works well except the case where there are only 6 numbers in the field. Then it returns an error.
0
Author Commented:
CS is not always part of it
0
Commented:
If always next to "CS"
=MID(A1,FIND("CS",A1)+3,6)

Duncan
0
Author Commented:
I found a work around to handle the records where it just contained 6 numbers, and Rey, your solution handled the rest.
0
Commented:
dgravitt,
cool, but next time, it will be helpful if all scenario about the data is available.
0
###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.