ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Inserting a hyphen after the 3rd character (https://www.excelbanter.com/excel-worksheet-functions/208263-inserting-hyphen-after-3rd-character.html)

[email protected]

Inserting a hyphen after the 3rd character
 
Hi All,

I am looking for a way to insert a hyphen (-) in a cell after the
third character. For example,

123456789 turns into 123-456789. Any ideas? Thanks in advance!!! Jen

Pete_UK

Inserting a hyphen after the 3rd character
 
One way:

=LEFT(A1,3)&"-"&RIGHT(A1,LEN(A1)-3))

Hope this helps.

Pete

On Oct 29, 6:42*pm, wrote:
Hi All,

I am looking for a way to insert a hyphen (-) in a cell after the
third character. For example,

123456789 turns into 123-456789. Any ideas? Thanks in advance!!! *Jen



Harlan Grove[_2_]

Inserting a hyphen after the 3rd character
 
Pete_UK wrote...
One way:

=LEFT(A1,3)&"-"&RIGHT(A1,LEN(A1)-3))

....

Shorter, simpler, more efficient to use

=REPLACE(A1,3,0,"-")

Sandy Mann

Inserting a hyphen after the 3rd character
 
Harlan,

I think that you may have meant:

=REPLACE(A1,4,0,"-")

to insert the hyphen after the third character not the second.

--
Regards,

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


Replace @mailinator.com with @tiscali.co.uk


"Harlan Grove" wrote in message
...
Pete_UK wrote...
One way:

=LEFT(A1,3)&"-"&RIGHT(A1,LEN(A1)-3))

...

Shorter, simpler, more efficient to use

=REPLACE(A1,3,0,"-")





All times are GMT +1. The time now is 07:02 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com