Text Extraction

DT3202

New Member
Joined
Oct 30, 2014
Messages
7
Office Version
  1. 2016
Platform
  1. Windows
Good Morning Everyone,
I have an issue where the clinical team is downloading csv files and manually copy/pasting summaries. The data from the system they use comes with text, symbols, and numbers in the cell. I only need the text and am trying to figure out how to extract it into another cell with a formula. Here is an example of the data:

1576168267437.png
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Try this UDF

VBA Code:
Function ExtractText(c As Range) As String
  With CreateObject("VBSCRIPT.REGEXP")
    .Pattern = "[^a-z]"
    .Global = True
    .IgnoreCase = True
    ExtractText = WorksheetFunction.Trim(.Replace(c.Value, " "))
  End With
End Function

HOW TO INSTALL UDFs
------------------------------------
If you are new to UDFs, they are easy to install and use. To install it, simply press ALT+F11 to go into the VB editor and, once there, click Insert/Module on its menu bar, then copy/paste the above code into the code window that just opened up. That's it.... you are done. You can now use ExtractText just like it was a built-in Excel function. For example,

Book1
AB
1OAI:1:100,43,255:;Pentax:1:1 98,0,34:;Fujifilm:1:129OAI Pentax Fujifilm
Sheet
Cell Formulas
RangeFormula
B1B1=ExtractText(A1)
 
Upvote 0
I'm glad to help you. Thanks for the feedback.
 
Upvote 0
I've run into a bit of an issue. Is there a way I can capture Gastropscopes on Colonoscopes in the below? I am getting all of the lower case letter as well using the extracttext forumula, as you can see on the right.

1576175985820.png
 

Attachments

  • 1576175904825.png
    1576175904825.png
    5.9 KB · Views: 1
Upvote 0
You could put the text instead of the image, that would help us to use the data, just copy the text from the cell and paste it here.
Also paste here the result you want.
 
Upvote 0
Here is the text:

35af8334-67ba-4020-b833-22a2b07408a3|Gown;0ffdc59f-6402-4a66-b3ba-cc02bef9ed13|Gloves;5f7af1d3-689d-48d4-b9c4-50aa30436003|Face shield;20c6ffd9-0dd1-4663-b99e-3860f493df6c|Hair covering;dd949532-1bbf-4d48-956d-4cde929003b1|Shoe covers

I would like:
Gown Gloves Face Shield Hair covering Shoe covers. There are a few with alphanumeric strings like this
 
Upvote 0
Always in all cells there is the pattern before each text the pipe "|" and ends with ";"

|Gown;
|Gloves;
|Face shield;

??
 
Upvote 0
yes. Each row with data starts with the string of numbers and letters followed by | and ending with ;
 
Upvote 0
maybe something like this
Column1
35af8334-67ba-4020-b833-22a2b07408a3|Gown;0ffdc59f-6402-4a66-b3ba-cc02bef9ed13|Gloves;5f7af1d3-689d-48d4-b9c4-50aa30436003|Face shield;20c6ffd9-0dd1-4663-b99e-3860f493df6c|Hair covering;dd949532-1bbf-4d48-956d-4cde929003b1|Shoe covers
Column1
Gown
Gloves
Face shield
Hair covering
Shoe covers

using Power Query
Code:
// Table1
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Split = Table.ExpandListColumn(Table.TransformColumns(Table.ReplaceValue(Source,"|","|@",Replacer.ReplaceText,{"Column1"}), {{"Column1", Splitter.SplitTextByAnyDelimiter({"|",";"}, QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Column1"),
    Replace = Table.ReplaceValue(Table.AlternateRows(Split,0,1,1),"@","",Replacer.ReplaceText,{"Column1"})
in
    Replace
 
Upvote 0

Forum statistics

Threads
1,215,343
Messages
6,124,402
Members
449,156
Latest member
LSchleppi

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