Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Sue Sue is offline
external usenet poster
 
Posts: 285
Default how to keep all leading zeros when stripping dashes from txt num

I have a text column that contains formatted numbers.
I need to strip the dashes, but preserve ALL numbers.
When I use replace to strip the dashes, Excel automatically changes the
cells to numbers format and I lose all the leading zeros.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,202
Default how to keep all leading zeros when stripping dashes from txt num

I have a text column that contains formatted numbers.
I need to strip the dashes, but preserve ALL numbers.
When I use replace to strip the dashes, Excel automatically
changes the cells to numbers format and I lose all the leading zeros.


This seems to work...

=SUBSTITUTE(A1,"-","")

where you would use your own cell reference in place of the A1.

Rick
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,268
Default how to keep all leading zeros when stripping dashes from txt num

Use a custom format like 000000

or how many digits you need, so if you want to display 12284567 as

012284567

and you always want to display 9 digits use a custom format of

000000000


note that if you have more than 15 digits it won't work, Excel's maximum
when it comes to a number is 15 digits so you can't numerically format
credit card numbers. Only text will work there


--
Regards,

Peo Sjoblom

"Sue" wrote in message
...
I have a text column that contains formatted numbers.
I need to strip the dashes, but preserve ALL numbers.
When I use replace to strip the dashes, Excel automatically changes the
cells to numbers format and I lose all the leading zeros.



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 136
Default how to keep all leading zeros when stripping dashes from txt num

Sue's is good.
Or you could format cells as Text (@) PRIOR to replacing hyphens.
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
Why do the preceding zeros disappear when I remove dashes? carridin1 Excel Discussion (Misc queries) 3 June 5th 07 11:19 PM
How can SS#s be displayed as text with all zeros and no dashes? latwood Excel Discussion (Misc queries) 1 September 27th 06 08:10 PM
Stop Excel from stripping out leading zeros when saving as CSV MattM Excel Discussion (Misc queries) 4 June 26th 06 11:35 AM
Stripping the dashes digital21st Excel Discussion (Misc queries) 4 May 23rd 06 03:43 PM
save text field w/ leading zeros in .csv format & not lose zeros? Ques Excel Discussion (Misc queries) 1 May 4th 05 06:21 PM


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