Solved

Returns a numbers from a string

Posted on 2014-07-30
9
162 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
  • 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 119

Accepted Solution

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

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

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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 

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 119

Expert Comment

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

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

920 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now