Solved

Returns a numbers from a string

Posted on 2014-07-30
9
165 Views
Last Modified: 2014-07-30
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.
0
Comment
Question by:dgravitt
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
  • +1
9 Comments
 
LVL 13

Expert Comment

by:duncanb7
ID: 40229351
Is it what your want ?

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

Duncan
0
 
LVL 19

Expert Comment

by:Montoya
ID: 40229359
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
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 40229403
this should do it

trim(mid(yourString,instrrev(yourString," ")))
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:dgravitt
ID: 40229417
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 Comment

by:dgravitt
ID: 40229431
Rey, yours works well except the case where there are only 6 numbers in the field. Then it returns an error.
0
 

Author Comment

by:dgravitt
ID: 40229462
CS is not always part of it
0
 
LVL 13

Expert Comment

by:duncanb7
ID: 40229475
If always next to "CS"
=MID(A1,FIND("CS",A1)+3,6)

Duncan
0
 

Author Closing Comment

by:dgravitt
ID: 40229523
I found a work around to handle the records where it just contained 6 numbers, and Rey, your solution handled the rest.
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 40229534
dgravitt,
cool, but next time, it will be helpful if all scenario about the data is available.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question