Link to home
Start Free TrialLog in
Avatar of dgravitt
dgravittFlag for United States of America

asked on

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.
Avatar of duncanb7
duncanb7

Is it what your want ?

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

Duncan
Avatar of Montoya
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
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dgravitt

ASKER

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

Duncan
I found a work around to handle the records where it just contained 6 numbers, and Rey, your solution handled the rest.
dgravitt,
cool, but next time, it will be helpful if all scenario about the data is available.