Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 27
Default Replace Comma with Dash

Hello,

Please can someone explain how I can replace commas with a dash/
hyphen. For example cell A1 contains "ABC,DEF,GHI". I would like
cell B1 to display "ABC-DEF-GHI".

I attempted to use REPLACE(A1,FIND(CHAR",",A1),1,",") but this only
replaces the first comma.

I need to cound how many comma's are in the text and then replace
them. I know I could you a find and replace but I need a formula.
The number of commas in the text will vary. Sometimes there are 2
other times there are none.

Thanks,
Brett
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default Replace Comma with Dash

Try,

Edit|Replace

Replace what ,
Replace with -

You now have a choice depending on the construction of your worksheet. You
can do a replace all but this will do precisely that even for commas you may
not want it to or you can step through with Find.

Mike

" wrote:

Hello,

Please can someone explain how I can replace commas with a dash/
hyphen. For example cell A1 contains "ABC,DEF,GHI". I would like
cell B1 to display "ABC-DEF-GHI".

I attempted to use REPLACE(A1,FIND(CHAR",",A1),1,",") but this only
replaces the first comma.

I need to cound how many comma's are in the text and then replace
them. I know I could you a find and replace but I need a formula.
The number of commas in the text will vary. Sometimes there are 2
other times there are none.

Thanks,
Brett

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 221
Default Replace Comma with Dash

Check out Rick Rothstein's reply in your other post.

His answer works as I have tried it myself.

Mark.


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Replace Comma with Dash

Was something wrong with the answer I gave you (in your first posting) some
48 minutes before you posted this same question over again?

Rick


wrote in message
...
Hello,

Please can someone explain how I can replace commas with a dash/
hyphen. For example cell A1 contains "ABC,DEF,GHI". I would like
cell B1 to display "ABC-DEF-GHI".

I attempted to use REPLACE(A1,FIND(CHAR",",A1),1,",") but this only
replaces the first comma.

I need to cound how many comma's are in the text and then replace
them. I know I could you a find and replace but I need a formula.
The number of commas in the text will vary. Sometimes there are 2
other times there are none.

Thanks,
Brett


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
Replace Comma's with Dash [email protected] Excel Worksheet Functions 3 May 5th 23 11:45 AM
replace dash in a number sequence Willy Wonka Excel Worksheet Functions 1 February 14th 08 12:04 AM
How to substitute a comma with a newline char using Replace. edspyhill01 Excel Discussion (Misc queries) 9 July 30th 06 12:38 AM
Replace Error with a Dash Karen Excel Worksheet Functions 3 March 14th 06 05:33 PM
Count comma separated numbers, numbers in a range with dash, not t Mahendra Excel Discussion (Misc queries) 0 August 8th 05 05:56 PM


All times are GMT +1. The time now is 12:16 AM.

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"