How to remove all text in parentheses from a line of text

divster27

New Member
Joined
Jan 19, 2021
Messages
32
Office Version
  1. 2016
Platform
  1. Windows
Hello,

I receive a datasheet from a supplier which has the artist, title and some further information in a string like this:

Dekker, Desmond / Double Dekker (2LP Gold Coloured)

I've used text to columns to split out Dekker, Desmond and Double Dekker into separate columns, Artist and Title
What i'd like to be able to do is before this create a new column that says:

"everything in parentheses move into another column, and remove the parentheses"

So it would become

ARTISTTITLENotes
Dekker, Desmond​
Double Dekker​
2LP Gold Coloured​

Any help appreciated!

David
Netdiscs
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Assuming your data starts in A1

VBA Code:
Sub jec()
 Dim ar, sp, j As Long, jj As Long
 ar = Range("A1", Range("A" & Rows.Count).End(xlUp)).Resize(, 10)
 
 For j = 1 To UBound(ar)
   sp = Split(Replace(Replace(ar(j, 1), ")", ""), "(", " / "), " / ")
   For jj = 0 To UBound(sp)
     ar(j, jj + 1) = sp(jj)
   Next
 Next
 
 Range("A1", Range("A" & Rows.Count).End(xlUp)).Resize(, 10) = ar
End Sub
 
Upvote 1
Thanks that looks almost there - just need to move the data to new columns - the code overtypes what is there already
 
Upvote 0
Ok, then write the last line as

VBA Code:
Range("A1", Range("A" & Rows.Count).End(xlUp)).Offset(,1).Resize(, 10) = ar
 
Upvote 0
Hiya - still doing the same as far as i can see
The spreadsheet has column headers as below
I want to move the data to columns J, K and L as below


orderStocknotesFormat
ARTIST / TITLE​
BarcodeCat numberLabel
Artist​
Title​
Note​
newNew release LAF exclusive MoV 9.FEB.24.£23.99VINYL
OST / Call Me By Your Name (2LP Translucent Pink Coloured)​
8719262033351MOVATM184TMUSIC ON VINYL
newNew release LAF exclusive MoV 9.FEB.24.£17.90VINYL
OST / It Follows (1LP Yellow & Green Coloured)​
8719262034020MOVATM311YMUSIC ON VINYL
newNew release LAF exclusive MoV 9.FEB.24.£17.90VINYL
OST / My Policeman (1LP Turquoise Coloured)​
8719262034617MOVATM366TUMUSIC ON VINYL
newNew release LAF exclusive MoV 9.FEB.24.£19.90VINYL
Dekker, Desmond / Double Dekker (2LP Gold Coloured)​
8719262029804MOVLP2483GMUSIC ON VINYL
newNew release LAF exclusive MoV 9.FEB.24.£15.50VINYL
Drop Nineteens / Delaware (1LP Black)​
0600753949955MOVLP3319MUSIC ON VINYL
newNew release LAF exclusive MoV 9.FEB.24.£24.90VINYL
Weather Report / Live In Tokyo (2LP Coloured)​
8719262030947MOVLP3521CMUSIC ON VINYL
newNew release LAF exclusive MoV 9.FEB.24.£16.50VINYL
Twenty 4 Seven / I Wanna Show You =30th Ann= (1LP Coloured)​
8719262033825MOVLP3671CMUSIC ON VINYL


I'm using the following code

Sub jec()
Dim ar, sp, j As Long, jj As Long
ar = Range("F1", Range("F" & Rows.Count).End(xlUp)).Resize(, 10)

For j = 1 To UBound(ar)
sp = Split(Replace(Replace(ar(j, 1), ")", ""), "(", " / "), " / ")
For jj = 0 To UBound(sp)
ar(j, jj + 1) = sp(jj)
Next
Next

Range("F1", Range("F" & Rows.Count).End(xlUp)).Offset(,1).Resize(, 10) = ar

End Sub
 
Upvote 0
Get and Transform Data on Data Tab

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Replaced Value" = Table.ReplaceValue(Source,"(","/",Replacer.ReplaceText,{"ARTIST / TITLE"}),
    #"Replaced Value1" = Table.ReplaceValue(#"Replaced Value",")","",Replacer.ReplaceText,{"ARTIST / TITLE"}),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Replaced Value1", "ARTIST / TITLE", Splitter.SplitTextByDelimiter("/", QuoteStyle.Csv), {"ARTIST / TITLE.1", "ARTIST / TITLE.2", "ARTIST / TITLE.3"}),
    #"Renamed Columns" = Table.RenameColumns(#"Split Column by Delimiter",{{"ARTIST / TITLE.1", "Artist"}, {"ARTIST / TITLE.2", "Title"}, {"ARTIST / TITLE.3", "Type"}}),
    #"Reordered Columns" = Table.ReorderColumns(#"Renamed Columns",{"order", "Stock", "notes", "Column1", "Format", "Barcode", "Cat number", "Label", "Artist", "Title", "Type"})
in
    #"Reordered Columns"

Book6
ABCDEFGHIJK
10orderStocknotesColumn1FormatBarcodeCat numberLabelArtistTitleType
11newNew release LAF exclusive MoV 9.FEB.24.£23.99VINYL8.71926E+12MOVATM184TMUSIC ON VINYLOST Call Me By Your Name 2LP Translucent Pink Coloured
12newNew release LAF exclusive MoV 9.FEB.24.£17.90VINYL8.71926E+12MOVATM311YMUSIC ON VINYLOST It Follows 1LP Yellow & Green Coloured
13newNew release LAF exclusive MoV 9.FEB.24.£17.90VINYL8.71926E+12MOVATM366TUMUSIC ON VINYLOST My Policeman 1LP Turquoise Coloured
14newNew release LAF exclusive MoV 9.FEB.24.£19.90VINYL8.71926E+12MOVLP2483GMUSIC ON VINYLDekker, Desmond Double Dekker 2LP Gold Coloured
15newNew release LAF exclusive MoV 9.FEB.24.£15.50VINYL6.00754E+11MOVLP3319MUSIC ON VINYLDrop Nineteens Delaware 1LP Black
16newNew release LAF exclusive MoV 9.FEB.24.£24.90VINYL8.71926E+12MOVLP3521CMUSIC ON VINYLWeather Report Live In Tokyo 2LP Coloured
17newNew release LAF exclusive MoV 9.FEB.24.£16.50VINYL8.71926E+12MOVLP3671CMUSIC ON VINYLTwenty 4 Seven I Wanna Show You =30th Ann= 1LP Coloured
Sheet2
 
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,164
Members
453,021
Latest member
Justyna P

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