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, [TABLE="width: 231"]
<tbody>[TR]
[TD="width: 231"]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.

[/TD]
[/TR]
</tbody>[/TABLE]
 
Last edited:

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
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,223,243
Messages
6,170,967
Members
452,371
Latest member
Frana

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