Removing last three chars

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a list of 100 countries with a bracket and number
e.g. China (23)

I want to replace the cells so that
China (23) >>> China

Thanks for your help
 
Dim cell as Range
Dim i as Long, sStr as String
for each cell in selection
i = instr(cell,"(")
if i > 0 then
sStr = trim(left(cell,i))
cell.value = sStr
End if
Next
 
teresa said:
I have a list of 100 countries with a bracket and number
e.g. China (23)

I want to replace the cells so that
China (23) >>> China

Thanks for your help

If this text is in A1, you can enter this formula in, say, B1:
=LEFT(A1,FIND(" ",A1,1))
Unfortunately, I have the Swedish version of Excel, I think the translation
is correct

If you have something like this "Sweden(46)" this function will search for
the bracket
=TRIM(LEFT(A1,FIND("(",A1,1)-1))

Now, do a copy and then Paste|Special, select the "Values" option in the
dialog

/Fredrik
 
Came From Chip's web page under first&last

A B C D
e.g. China (23) 2 1 =MID(A9,SMALL(IF(MID("
"&A9,ROW(INDIRECT("1:"&LEN(A9)+1)),1)="
",ROW(INDIRECT("1:"&LEN(A9)+1))),B9),SUM(SMALL(IF(MID(" "&A9&"
",ROW(INDIRECT("1:"&LEN(A9)+2)),1)="
",ROW(INDIRECT("1:"&LEN(A9)+2))),B9+C9*{0,1})*{-1,1})-1)

A B C D
China (23) 1 1 =MID(A12,SMALL(IF(MID("
"&A12,ROW(INDIRECT("1:"&LEN(A12)+1)),1)="
",ROW(INDIRECT("1:"&LEN(A12)+1))),B12),SUM(SMALL(IF(MID(" "&A12&"
",ROW(INDIRECT("1:"&LEN(A12)+2)),1)="
",ROW(INDIRECT("1:"&LEN(A12)+2))),B12+C12*{0,1})*{-1,1})-1)

Hope it helps
Esau
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Help with Dual Conditional issue (sumif?) 2
Using OR and wildcard 1
Conditional Ranking 8
combing cells with same data 2
For Sale Ulefone Armor X5 7
Counting specific text in two columns. 5
Summing up Data 10
AliExpress 4

Back
Top