Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default How do I add dashes to a string?

I have a column of thext in Excel that is

111222333
or
111222333L

And want to convert it so that it reads

111-222-333
or
111-222-333L

I have applied "=TEXT(A1, "000-000-000")" and have the format
"111-222-333" but when the original string has an "L" on the end, it's not
included. How can I reformat and preserve the L when it is in the original
string?

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 180
Default How do I add dashes to a string?

this should help

=TEXT(MID(J5,1,LEN(J5)-1),"000-000-000")&RIGHT(J5,1)

--
Pranav Vaidya
VBA Developer
PN, MH-India
If you think my answer is useful, please rate this post as an ANSWER!!


"57chevy" wrote:

I have a column of thext in Excel that is

111222333
or
111222333L

And want to convert it so that it reads

111-222-333
or
111-222-333L

I have applied "=TEXT(A1, "000-000-000")" and have the format
"111-222-333" but when the original string has an "L" on the end, it's not
included. How can I reformat and preserve the L when it is in the original
string?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,624
Default How do I add dashes to a string?

One way:


=IF(ISNUMBER(A1),TEXT(A1,"000-000-000"),LEFT(A1,3)&"-"&MID(A1,4,3)&"-"&MI
D(A1,7,255))


(where 255 is just a big number - any number 4 or greater will work).



In article ,
57chevy wrote:

I have a column of thext in Excel that is

111222333
or
111222333L

And want to convert it so that it reads

111-222-333
or
111-222-333L

I have applied "=TEXT(A1, "000-000-000")" and have the format
"111-222-333" but when the original string has an "L" on the end, it's not
included. How can I reformat and preserve the L when it is in the original
string?

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,651
Default How do I add dashes to a string?

=LEFT(A1,3)&"-"&MID(A1,4,3)&"-"&RIGHT(A1,LEN(A1)-6)
--
David Biddulph

"57chevy" wrote in message
...
I have a column of thext in Excel that is

111222333
or
111222333L

And want to convert it so that it reads

111-222-333
or
111-222-333L

I have applied "=TEXT(A1, "000-000-000")" and have the format
"111-222-333" but when the original string has an "L" on the end, it's not
included. How can I reformat and preserve the L when it is in the
original
string?



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
What are dashes for WLMPilot Excel Discussion (Misc queries) 3 November 27th 06 11:03 PM
Add Dashes within aText String RC Excel Discussion (Misc queries) 8 October 25th 06 10:14 PM
Stripping the dashes digital21st Excel Discussion (Misc queries) 4 May 23rd 06 03:43 PM
using dashes and the arrow key cyndi Excel Discussion (Misc queries) 1 February 2nd 05 09:53 PM
dashes in vlookup anthonyn Excel Worksheet Functions 3 November 23rd 04 06:40 AM


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