Help with formula for isolating text in Cell

EQUILIBRIUM89

New Member
Joined
Nov 19, 2014
Messages
10
Good afternoon everyone,

I am currently working on a project and am stumped on creating a formula for isolating a block of text within a cell. For example,
HEX,1YRBL,VTIS,V632,WETEND

I only need V632. How would you isolate this?

Note: the V632 is a part number and will change as there are 1000 part numbers. So I would need a formula that deals with positioning?

Any help would be great. Thanks.


<tbody>
</tbody>
 
Last edited:

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Will the part number always be between the last two commas in the cell?
 
Upvote 0
UDF for your help.
Code:
Function GetNumber(cell As Range) As String
    Dim re As Object
    Set re = CreateObject("VBScript.RegExp")
    re.IgnoreCase = True
    re.Pattern = "\b\w\d+\b"
    GetNumber = re.Execute(cell.Value)(0)
    Set re = Nothing
End Function
 
Upvote 0
It's all simple.
1. Press Alt + F11.
2. Execute: Insert -> Module.
3. Paste UDF into code window.
4. Go to your worksheet and start typing (assuming the text is in cell A1): =GetNumber(A1)
 
Upvote 0

Forum statistics

Threads
1,214,975
Messages
6,122,538
Members
449,088
Latest member
RandomExceller01

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