extract only the numbers between Parenthesis

jcbek11

New Member
Joined
Jun 28, 2013
Messages
48
I would like to know what the easiest VBA function is to extract only the numbers that are between Parenthesis

For example if I had a cell with (NMLS343432) and I wanted to only extract the number and put it into the cell next to
the cell with the value.

What is the shortest VBA function that could do this?
 
Would this be better?
Code:
Sub Fill_It()
    Dim lr As Long
    lr = Sheets(1).Cells(Rows.Count, 1).End(xlUp).Row
    Range("B3:B" & lr).Value = "=GetNumber(RC[-1])"
End Sub
If the OP's range is fixed between Rows 3:350 as he indicated in previous posts, then all the numbers between parentheses can be accomplished with a single lne of code (the GetNumber function would not be needed)...
Code:
Sub Fill_It2()
  [B3:B520] = [IF(A3:A520="""","""",MID(LEFT(A3:A520,FIND(")",A3:A520&")")-1),FIND("NMLS",A3:A520&"NMLS")+4,99))]
End Sub
 
Upvote 0

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Hi Rick
Indeed, if the range never changes. That would be a big if though, wouldn't you think so.
In many of these threads I have seen people ask for a formula or code pertaining to a certain range/cell/column.
A few posts later they'll come with a different scenario, sometimes not even close to their original question. I guess it is all in the eye of the beerholder.
No doubt in my mind that you have seen posts where you know that the OP knows what he wants but sometimes it is difficult to explain that.
All in good faith though Rick. I always study your posts. I have been learning for the last just about 70 years and still at it. I think there will never come an end to it (I hope)
Have a good night Rick.
Regards
John
 
Upvote 0

Forum statistics

Threads
1,217,383
Messages
6,136,244
Members
450,001
Latest member
KWeekley08

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