Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Adding hyphen to text in cell

I would like to add a hypen to the text that exists on the excel sheet. Is
there a formula for this?

example of text on sheet without hypen:
G212DA

text with hypen:
G-212DA


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 492
Default Adding hyphen to text in cell

Assuming you always want the hyphen after the first character,

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

Regards,
Alan.
"Penny" wrote in message
...
I would like to add a hypen to the text that exists on the excel sheet. Is
there a formula for this?

example of text on sheet without hypen:
G212DA

text with hypen:
G-212DA



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7,247
Default Adding hyphen to text in cell

Try

=LEFT(A1,1)&"-"&MID(A1,2,999)

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Tue, 24 Mar 2009 08:12:01 -0700, Penny
wrote:

I would like to add a hypen to the text that exists on the excel sheet. Is
there a formula for this?

example of text on sheet without hypen:
G212DA

text with hypen:
G-212DA

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 38
Default Adding hyphen to text in cell

My mistake.. not all need it after the first character. I also need after
second:

example:
GA02004
Example:
GA-02004

"Alan" wrote:

Assuming you always want the hyphen after the first character,

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

Regards,
Alan.
"Penny" wrote in message
...
I would like to add a hypen to the text that exists on the excel sheet. Is
there a formula for this?

example of text on sheet without hypen:
G212DA

text with hypen:
G-212DA




  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 492
Default Adding hyphen to text in cell

Change the formula to,

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

You could enter where you want the hyphen in an adjacent cell, if you enter
1 in B1

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

will give you G-212DA, enter 2 and you have G2-12DA

Regards,
Alan.

But
"mePenny" wrote in message
...
My mistake.. not all need it after the first character. I also need after
second:

example:
GA02004
Example:
GA-02004

"Alan" wrote:

Assuming you always want the hyphen after the first character,

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

Regards,
Alan.
"Penny" wrote in message
...
I would like to add a hypen to the text that exists on the excel sheet.
Is
there a formula for this?

example of text on sheet without hypen:
G212DA

text with hypen:
G-212DA







  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 38
Default Adding hyphen to text in cell

Thank you Alan for your help. Worked out perfectly!

"Alan" wrote:

Change the formula to,

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

You could enter where you want the hyphen in an adjacent cell, if you enter
1 in B1

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

will give you G-212DA, enter 2 and you have G2-12DA

Regards,
Alan.

But
"mePenny" wrote in message
...
My mistake.. not all need it after the first character. I also need after
second:

example:
GA02004
Example:
GA-02004

"Alan" wrote:

Assuming you always want the hyphen after the first character,

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

Regards,
Alan.
"Penny" wrote in message
...
I would like to add a hypen to the text that exists on the excel sheet.
Is
there a formula for this?

example of text on sheet without hypen:
G212DA

text with hypen:
G-212DA






  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 492
Default Adding hyphen to text in cell

That's good. If you want to make the result permanent, ie lose the formulas,
highlight the whole range, right click 'Copy', right click again, 'Paste
Special', check 'Values', OK.
You can then copy and paste the list to overwrite the original list. Best to
do this in a copy of the workbook.
Regards,
Alan.
"mePenny" wrote in message
...
Thank you Alan for your help. Worked out perfectly!

"Alan" wrote:

Change the formula to,

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

You could enter where you want the hyphen in an adjacent cell, if you
enter
1 in B1

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

will give you G-212DA, enter 2 and you have G2-12DA

Regards,
Alan.

But
"mePenny" wrote in message
...
My mistake.. not all need it after the first character. I also need
after
second:

example:
GA02004
Example:
GA-02004

"Alan" wrote:

Assuming you always want the hyphen after the first character,

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

Regards,
Alan.
"Penny" wrote in message
...
I would like to add a hypen to the text that exists on the excel
sheet.
Is
there a formula for this?

example of text on sheet without hypen:
G212DA

text with hypen:
G-212DA







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
Extracting (Copying) Text to the Right of a Hyphen ConfusedNHouston Excel Discussion (Misc queries) 3 September 5th 08 07:39 PM
hyphen (nit minus) in cell Appalachia Excel Discussion (Misc queries) 3 September 19th 07 01:39 PM
Copy Text to Right of Hyphen ConfusedNHouston Excel Discussion (Misc queries) 3 July 27th 06 07:25 PM
Truncating text before a hyphen tcjay Excel Worksheet Functions 1 September 6th 05 12:43 PM
How do you change sort defaults for combined text number & hyphen. Anna Excel Discussion (Misc queries) 1 April 8th 05 05:01 AM


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

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

About Us

"It's about Microsoft Excel"