Extract words from cells

kudanrid

New Member
Joined
Aug 3, 2019
Messages
3
Hello,

This is my first post here.
How do I extract words from this cell ...

<tbody>
[TD="class: xl67"]03.07.2019 14:57:57 - Jasmine Chew (Work notes)
machine offline

02.07.2019 14:02:23 - Eddie Sayari (Work notes)
Nuance aG - Nuance - Nuance Power PDF Advanced 3.0 - WIN EN - SR05271 - 1.0 3.0
Running application deployment evaluation cycle...

23.06.2019 21:29:22 - Eddie Sayari (Work notes)
Nuance aG - Nuance - Nuance Power PDF Advanced 3.0 - WIN EN - SR05271 - 1.0 3.0
Status unknown - This computer might be offline

20.06.2019 17:09:43 - Balazs Kis (Work notes)
new sccm

Nuance aG - Nuance - Nuance Power PDF Advanced 3.0 - WIN EN - SR05271 - 1.0 3.0
Adding to install collection...[/TD]

</tbody>

So I'll end up with just date/time and its corresponding name like below

<tbody>
[TD="class: xl66"]03.07.2019 14:57:57 - Jasmine Chew
02.07.2019 14:02:23 - Eddie Sayari
23.06.2019 21:29:22 - Eddie Sayari
20.06.2019 17:09:43 - Balazs Kis[/TD]

</tbody>


Any help is much appreciated :)
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
are the all the same format ?
 
Upvote 0
Assuming the text is in separate cells, try

Book1
AB
103.07.2019 14:57:57 - Jasmine Chew (Work notes) machine offline03.07.2019 14:57:57 - Jasmine Chew
202.07.2019 14:02:23 - Eddie Sayari (Work notes) Nuance aG - Nuance - Nuance Power PDF Advanced 3.0 - WIN EN - SR05271 - 1.0 3.0 Running application deployment evaluation cycle02.07.2019 14:02:23 - Eddie Sayari
323.06.2019 21:29:22 - Eddie Sayari (Work notes) Nuance aG - Nuance - Nuance Power PDF Advanced 3.0 - WIN EN - SR05271 - 1.0 3.0 Status unknown - This computer might be offline23.06.2019 21:29:22 - Eddie Sayari
420.06.2019 17:09:43 - Balazs Kis (Work notes) new sccm Nuance aG - Nuance - Nuance Power PDF Advanced 3.0 - WIN EN - SR05271 - 1.0 3.0 Adding to install collection20.06.2019 17:09:43 - Balazs Kis
Sheet1
Cell Formulas
RangeFormula
B1=IFERROR(LEFT(A1,FIND("(",A1)-1),"")
 
Upvote 0
no they're not in separate cell, all that are in a cell. There will be many more cell like it and their character length are unlikely to be the same.
 
Upvote 0
no they're not in separate cell, all that are in a cell.
Here is a UDF (user defined function) that you can try...
Code:
[table="width: 500"]
[tr]
	[td]Function DateName(S As String) As String
  Dim X As Long, vNum As Variant, Arr As Variant
  Arr = Split(S, vbLf & vbLf)
  For X = 0 To UBound(Arr)
    If Arr(X) Like "##.##.####*" Then
      Arr(X) = Trim(Left(Arr(X), InStr(Arr(X), "(") - 1))
    Else
      Arr(X) = ""
    End If
  Next
  DateName = Join(Arr, vbLf)
  For Each vNum In Array(121, 13, 5, 3, 3, 2)
    DateName = Replace(DateName, String(vNum, vbLf), vbLf)
  Next
  If Right(DateName, 1) = vbLf Then DateName = Left(DateName, Len(DateName) - 1)
End Function[/td]
[/tr]
[/table]

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 DateName just like it was a built-in Excel function. For example,

=DateName(A1)

NOTE: Make sure to turn Wrap Text on for the cell you put this formula in.

If you are using XL2007 or above, make sure you save your file as an "Excel Macro-Enabled Workbook (*.xlsm) and answer the "do you want to enable macros" question as "yes" or "OK" (depending on the button label for your version of Excel) the next time you open your workbook.
 
Upvote 0
Welcome to the MrExcel board!

You could try this user-defined function. To implement ..
1. Right click the sheet name tab and choose "View Code".
2. In the Visual Basic window use the menu to Insert|Module
3. Copy and Paste the code below into the main right hand pane that opens at step 2.
4. Close the Visual Basic window.
5. Enter the formula as shown in the screen shot below and copy down. You may need to format the result column with 'Wrap Text'.
6. Your workbook will need to be saved as a macro-enabled workbook (*.xlsm)

Code:
Function GetEm(s As String) As String
  Dim RX As Object, m As Object
  
  Set RX = CreateObject("VBScript.RegExp")
  RX.Global = True
  RX.Pattern = "(\d\d\.){2}\d{4} (\d\d:){2}\d{2} - .+?(?= ?\()"
  For Each m In RX.Execute(s)
    GetEm = GetEm & Chr(10) & m
  Next m
  GetEm = Mid(GetEm, 2)
End Function

Excel Workbook
AB
103.07.2019 14:57:57 - Jasmine Chew (Work notes)machine offline02.07.2019 14:02:23 - Eddie Sayari (Work notes)Nuance aG - Nuance - Nuance Power PDF Advanced 3.0 - WIN EN - SR05271 - 1.0 3.0 Running application deployment evaluation cycle...23.06.2019 21:29:22 - Eddie Sayari (Work notes)Nuance aG - Nuance - Nuance Power PDF Advanced 3.0 - WIN EN - SR05271 - 1.0 3.0 Status unknown - This computer might be offline20.06.2019 17:09:43 - Balazs Kis (Work notes)new sccmNuance aG - Nuance - Nuance Power PDF Advanced 3.0 - WIN EN - SR05271 - 1.0 3.0 Adding to install collection...03.07.2019 14:57:57 - Jasmine Chew02.07.2019 14:02:23 - Eddie Sayari23.06.2019 21:29:22 - Eddie Sayari20.06.2019 17:09:43 - Balazs Kis
Sheet1
 
Upvote 0
with PowerQuery

[Table="width:, class:head"]
[tr=bgcolor:#FFFFFF][td=bgcolor:#5B9BD5]Column1[/td][td][/td][td=bgcolor:#70AD47]Custom.1[/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#DDEBF7]03.07.2019 14:57:57 - Jasmine Chew (Work notes)
machine offline

02.07.2019 14:02:23 - Eddie Sayari (Work notes)
Nuance aG - Nuance - Nuance Power PDF Advanced 3.0 - WIN EN - SR05271 - 1.0 3.0
Running application deployment evaluation cycle...

23.06.2019 21:29:22 - Eddie Sayari (Work notes)
Nuance aG - Nuance - Nuance Power PDF Advanced 3.0 - WIN EN - SR05271 - 1.0 3.0
Status unknown - This computer might be offline

20.06.2019 17:09:43 - Balazs Kis (Work notes)
new sccm

Nuance aG - Nuance - Nuance Power PDF Advanced 3.0 - WIN EN - SR05271 - 1.0 3.0
Adding to install collection...[/td][td][/td][td=bgcolor:#E2EFDA]03.07.2019 14:57:57 - Jasmine Chew
02.07.2019 14:02:23 - Eddie Sayari
23.06.2019 21:29:22 - Eddie Sayari
20.06.2019 17:09:43 - Balazs Kis[/td][/tr]
[/table]


Code:
[SIZE=1]// Table1
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Split = Table.ExpandListColumn(Table.TransformColumns(Source, {{"Column1", Splitter.SplitTextByDelimiter("#(lf)", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Column1"),
    If = Table.AddColumn(Split, "Custom", each if Text.Contains([Column1], " (") then "x" else null),
    Filter = Table.SelectRows(If, each ([Custom] = "x")),
    ExtractBD = Table.TransformColumns(Filter, {{"Column1", each Text.BeforeDelimiter(_, " ("), type text}}),
    Group = Table.Group(ExtractBD, {"Custom"}, {{"Count", each _, type table}}),
    List = Table.AddColumn(Group, "Custom.1", each Table.Column([Count],"Column1")),
    Extract = Table.TransformColumns(List, {"Custom.1", each Text.Combine(List.Transform(_, Text.From), "#(lf)"), type text}),
    ROC = Table.SelectColumns(Extract,{"Custom.1"})
in
    ROC[/SIZE]
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,264
Members
452,627
Latest member
KitkatToby

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