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

Hello,

I would like to replace commas with a hyphen/dash. For example cell
A1 contains "ABC,DEF,GHI", I would like to replace the "," with "-"
i.e. "ABC,DEF,GHI".

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

I need to find out how many "," are in the text and replace them all.
I know I could use find and replace but I need to use a formula.

Thanks in advance,

Brett
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,942
Default Replace Comma with "-"

hi
use the substitute function.
if data in A2 then
=SUBSTITUTE(A2,",","-")
or substitute(text or cell, text to sub or ",", replacmetn text or "-",
number of instances. if number of instances is omitted, the formula replaces
all.

Regards
FSt1

" wrote:

Hello,

I would like to replace commas with a hyphen/dash. For example cell
A1 contains "ABC,DEF,GHI", I would like to replace the "," with "-"
i.e. "ABC,DEF,GHI".

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

I need to find out how many "," are in the text and replace them all.
I know I could use find and replace but I need to use a formula.

Thanks in advance,

Brett

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default Replace Comma with "-"

Hi,

I count that you've posted this question 6 times and have several solutions,
why don't you look at those?

Mike

" wrote:

Hello,

I would like to replace commas with a hyphen/dash. For example cell
A1 contains "ABC,DEF,GHI", I would like to replace the "," with "-"
i.e. "ABC,DEF,GHI".

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

I need to find out how many "," are in the text and replace them all.
I know I could use find and replace but I need to use a formula.

Thanks in advance,

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 with "-". [email protected] Excel Discussion (Misc queries) 1 April 18th 08 01:51 PM
no comma separator for ="total"&"$ "&sum(a1:a10) Jeff Excel Worksheet Functions 3 August 9th 06 06:06 PM
How to replace "#N/A" w "0"when vlookup couldn't find the match? Holly Excel Discussion (Misc queries) 2 July 18th 06 12:48 AM
Replace dialog should put focus on "Find What" not "Replace With" Michael Williams Excel Discussion (Misc queries) 0 May 24th 06 01:45 PM
Can you replace "TRUE" with " " in an exact formula? Sweetetc Excel Worksheet Functions 2 February 10th 06 02:11 PM


All times are GMT +1. The time now is 05:07 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"