Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 169
Default Removing last three chars

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Removing last three chars

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

--
regards,
Tom Ogilvy


"teresa" wrote in message
...
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 339
Default Removing last three chars


"teresa" wrote in message
...
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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Removing last three chars

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(I F(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

"teresa" wrote:

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to truncate list of meaningful words greater than 15 chars tomeaningful words of 8 chars. Babloo Excel Worksheet Functions 4 April 29th 11 11:27 PM
limit # of chars in a cell soonic Excel Discussion (Misc queries) 1 March 22nd 10 11:21 AM
sum first 2 chars if 3rd is something... [email protected] Excel Discussion (Misc queries) 13 September 29th 06 02:30 PM
determine if ea value in a col has more than 20 chars pmms Excel Discussion (Misc queries) 2 March 16th 06 03:11 PM
How to use OLEDB and Reserved Chars Tyler Davey Excel Programming 3 August 10th 04 10:09 AM


All times are GMT +1. The time now is 12:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"