Extract set number in different lines in given string

harinsh

Active Member
Joined
Feb 7, 2012
Messages
273
Hi Team,


is anyone help me with below requirement ...in the given example string ...need to eliminate what is there in brackets and need the numbers in each line. If you see ** thes two stars will separate the each numbers in each string. I believe based on the these stars need to build the macro or any formula....


Example:
123455(final)*6256656(in progress)**7651623(closed)


Output:
123455
6256656
7651623


Let me know if you need any clarification.
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Would this user-defined function be any use? To implement ..
1. Right click the sheet name tab and choose "View Code".
2. In the Visual Basic window use the menu to Insert|Module
3. Copy and Paste the code below into the main right hand pane that opens at step 2.
4. Close the Visual Basic window.
5. Enter the formula as shown in the screen shot below and copy across (& down?).
6. Your workbook will need to be saved as a macro-enabled workbook (*.xlsm)

Code:
Function GetNum(s As String, Num As Long) As Variant
  Static RX As Object, M As Object

  If RX Is Nothing Then
    Set RX = CreateObject("VBScript.RegExp")
    RX.Global = True
  End If
  RX.Pattern = "\d+(?=\()"
  Set M = RX.Execute(s)
  GetNum = vbNullString
  If Num <= M.Count Then GetNum = Val(M(Num - 1))
End Function

Excel Workbook
ABCDE
1123455(final)*6256656(in progress)**7651623(closed)12345562566567651623
Sheet1
 
Upvote 0

Forum statistics

Threads
1,215,330
Messages
6,124,305
Members
449,150
Latest member
NyDarR

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top