Assistance required

mdb231

Board Regular
Joined
May 16, 2006
Messages
73
Hi all I am into horseracing and download results via a program which someone did for me, the thing I would like assistance with, is when the names get downloaded they are have in brackets following the name the country where the horse is bred.,but when I do a search it can miss some because of this.
Is there a macro or something that will take these off so all that is left is the name or the horse.
Any help appreciated.
Michael
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Please post an example of what the data looks like, and what you want your expected results to look like.
 
Upvote 0
Fast And Hot (IRE)
Bird For Life
General Brook (IRE)
Hong Kong Joe
Munsarim (IRE)
Joshlee (IRE)
Thahab Ifraj (IRE)
Garcon De Soleil
Xhale (FR)
Roy Rocket (FR)
Takeitfromalady (IRE)
Lady Of York
Iley Boy
Warofindependence (USA)
Hi There Silver (IRE)
Pack It In (IRE)
Feel The Vibes
Spiritofedinburgh (IRE)
Patent
Santadelacruze
Bookmaker
Rattle On
The King's Steed (ex6)
Bertie Blu Boy
Ertidaad (IRE)
Mowhoob
Tarseekh
Rocksette
Caius College Girl (IRE)
How's Lucy
Excellent World (IRE)
Mime Dance
De Little Engine (IRE)

Anything with the brackets needs to go, can occasionally contain numbers. Sorry it's not in excel but long time since I was on here and have forgotten how to add a file from excel.
Hope this helps.
 
Upvote 0
Assuming your first value starts in cell A1, use this formula and copy down for all rows:
Code:
=IF(ISNUMBER(FIND("(",A1)),TRIM(LEFT(A1,FIND("(",A1)-1)),A1)
 
Upvote 0
You are welcome.

If you would like to replace the original data instead of having a new column, you can use Text to Columns, using the "(" as your delimiter.
If you do that with VBA, you can do it even quicker, simply by running the macro. That code would look like:
Code:
Sub CropData()

    Range("A:A").TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _
        TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
        Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar _
        :="(", FieldInfo:=Array(Array(1, 1), Array(2, 9)), TrailingMinusNumbers:=True

End Sub
 
Upvote 0
Hi,

Another formula option:


Excel 2010
AB
1Fast And Hot (IRE)Fast And Hot
2Bird For LifeBird For Life
3General Brook (IRE)General Brook
4Hong Kong JoeHong Kong Joe
5Munsarim (IRE)Munsarim
6Joshlee (IRE)Joshlee
7Thahab Ifraj (IRE)Thahab Ifraj
8Garcon De SoleilGarcon De Soleil
9Xhale (FR)Xhale
10Roy Rocket (FR)Roy Rocket
11Takeitfromalady (IRE)Takeitfromalady
12Lady Of YorkLady Of York
13Iley BoyIley Boy
14Warofindependence (USA)Warofindependence
15Hi There Silver (IRE)Hi There Silver
16Pack It In (IRE)Pack It In
17Feel The VibesFeel The Vibes
18Spiritofedinburgh (IRE)Spiritofedinburgh
19PatentPatent
20SantadelacruzeSantadelacruze
21BookmakerBookmaker
22Rattle OnRattle On
23The King's Steed (ex6)The King's Steed
24Bertie Blu BoyBertie Blu Boy
25Ertidaad (IRE)Ertidaad
26MowhoobMowhoob
27TarseekhTarseekh
28RocksetteRocksette
29Caius College Girl (IRE)Caius College Girl
30How's LucyHow's Lucy
31Excellent World (IRE)Excellent World
32Mime DanceMime Dance
33De Little Engine (IRE)De Little Engine
Sheet16
Cell Formulas
RangeFormula
B1=TRIM(REPLACE(A1,FIND("(",A1&"("),255,""))


B1 formula copied down.
 
Upvote 0
If you would like to replace the original data instead of having a new column, you can use Text to Columns, ..
.. or similar to Joe's idea but even more simply (to me at least) with Find/Replace with " (*)" (without the "") typed into the Find What box & nothing in the Replace with box & not matching entire contents. As a macro that would be
Code:
Sub remove_country()
  Range("A2", Range("A" & Rows.Count).End(xlUp)).Replace What:=" (*)", Replacement:="", LookAt:=xlPart
End Sub

Edit: Or if you did want to keep the original data and put the results in the next column
Code:
Sub remove_country_v2()
  With Range("A2", Range("A" & Rows.Count).End(xlUp))
    .Offset(, 1).Value = Evaluate(Replace("if(#="""","""",left(#,find(""("",#&"" ("")-1))", "#", .Address))
  End With
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,746
Messages
6,180,705
Members
452,994
Latest member
Janick

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