Function or macro to extract data from a unstructured cell containing text

tkeiffer

New Member
Joined
Aug 5, 2005
Messages
20
Office Version
  1. 365
Platform
  1. Windows
Hello
I'm trying to find a way to extract a User ID from cells in a field called Metadata. The data is not in a similar format in each cell and I've been racking my brain trying to figure out how to easily extract the User ID to an adjacent cell so I can run it easily daily without having to manually pull it out. The example below is just 2 examples but the spreadsheet has many rows of similar data in the Metadata column. Is there a way I could extract the data between "User ID" and the comma after it, such as "A0019015260" in the first row, and "B757182" in the second row as per the desired results below? I just can't think of a way to do it. Can anyone help me???

Column A Metadata
Row 1
Metadata (Column Title)
Row 2
[Product:ABC, DEF, Question:[Location:https://webaddress.html, Source:Widget, User ID:A0019015260, Product:SAP ASE, ERP enablement]]
Row 3
[Product:GHI, Question:[Source:Form, product:GHI, User ID:B757182, Location:http://webaddress.html]]

Column B
Row 1
User ID (Column Title)
Row 2
A0019015260
Row 3
B757182
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
I figured it out. I need to add this user defined function to a module. Usage =userid(A1)

Function UserID(r As Range) As String
Dim strTemp As String
Dim intPos As Integer

strTemp = Split(r, "User ID:")(1)
intPos = InStr(1, strTemp, ",")
UserID = Left(strTemp, intPos - 1)
End Function
 
Upvote 0

Forum statistics

Threads
1,223,900
Messages
6,175,276
Members
452,629
Latest member
SahilPolekar

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