Extract every words, after certain character, in any position within a cell. Then split

superjoejoe

New Member
Joined
Jul 2, 2020
Messages
4
Office Version
  1. 2019
Platform
  1. Windows

Attachments

  • tanya.png
    tanya.png
    30.7 KB · Views: 21
Last edited by a moderator:

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Assuming your data as follows.
varios 06jul2020.xlsm
ABCDE
1List
2Chrismas, Festive, OuterwearOuterwearChrismas, FestiveTop
3Chinese New Year, SetsSetsChinese New YearOuterwear
4ShoesShoesSets
5Shoes
6and so on
7
8
9
Hoja4

Try this:

VBA Code:
Sub test()
  Dim c As Range, rList As Range, f As Range
  Dim sWord As Variant, cad1 As String, cad2 As String
  
  Set rList = Range("E2", Range("E" & Rows.Count).End(3))
  For Each c In Range("A2", Range("A" & Rows.Count).End(3))
    cad1 = ""
    cad2 = ""
    For Each sWord In Split(c, ",")
      Set f = rList.Find(Trim(sWord), , xlValues, xlWhole)
      If Not f Is Nothing Then
        cad1 = cad1 & Trim(sWord) & ", "
      Else
        cad2 = cad2 & Trim(sWord) & ", "
      End If
    Next sWord
    If cad1 <> "" Then c.Offset(, 1).Value = Left(cad1, Len(cad1) - 2)
    If cad2 <> "" Then c.Offset(, 2).Value = Left(cad2, Len(cad2) - 2)
  Next c
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,632
Messages
6,173,472
Members
452,516
Latest member
archcalx

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