Removing Letters with brackets from inside a cell

Pauls123

Board Regular
Joined
Mar 22, 2011
Messages
180
Hi all,

A little while since I been here. My question is after copying and pasting data from a website to Excel 2010, I am left with say"

Paul (NZ) or say Paul (IRE), for example.

I just want Paul shown and not the brackets or letters contained therein.

Regards, Paul
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Thanks VoG, That seems to work except there could be other cells under it, where there are no brackets. Will this work if there isnt any brackets,

Regards
Paul
 
Upvote 0
Try

Method 1
=IF(ISERROR(LEFT(A1,FIND("(",A1)-2)),A1,LEFT(A1,FIND("(",A1)-2))

Method 2
=IF(ISERROR(LEFT(A2,FIND("(",A2)-2)),"",LEFT(A2,FIND("(",A2)-2))

Which method answers your question?

Biz
 
Upvote 0
it doesnt seem to work if there are no brackets after names. Sometimes in my spreadsheet, some cells will have brackets (with letters in them), others wont,

Regards
Paul
 
Upvote 0
it doesnt seem to work if there are no brackets after names. Sometimes in my spreadsheet, some cells will have brackets (with letters in them), others wont,

Regards
Paul

Give some examples.
 
Upvote 0
Hi Biz, Your reply come in exactly the same time as I typed my other post. Your Method 1 works perfectly, thanks very much.

Regards

Paul
 
Upvote 0
UDF

Code:
Function ExtractStr(str As String) As String
    With CreateObject("VBScript.RegExp")
        .Pattern = "\w+(?!\))"
        ExtractStr = .Execute(str)(0)
    End With
End Function
 
Upvote 0
Hi Biz, Your reply come in exactly the same time as I typed my other post. Your Method 1 works perfectly, thanks very much.

Regards

Paul


Thanks for your feedback

Biz
 
Upvote 0
UDF

Code:
Function ExtractStr(str As String) As String
    With CreateObject("VBScript.RegExp")
        .Pattern = "\w+(?!\))"
        ExtractStr = .Execute(str)(0)
    End With
End Function


Nice RegExp mate.

Biz
 
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,827
Members
452,946
Latest member
JoseDavid

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