Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Adding a leading zero "0" to a number in a cell

I am trying to create a formula that will add a leading zerto to any number
that comes in with less than 5 digits. This is for a spreadsheet that will
carry over zip codes for a mailing. I want to know if I can write a formula
and if so, what it is that if a column of numbers just has 234 that the
formula will automatically add the two zeros making it 00234. Or if it is
2345 it will convert it to 02345.

Also - will the leading zeros (for lack of a better term) be hard coded so
that when you extor to a csv or another format, the zeros will remain.

Thanks
--
Chip
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 131
Default Adding a leading zero "0" to a number in a cell

supposing your 234 value is in cell A1, your formula would be:
=TEXT(A1,"00000")

Yes, these will be sustained through saving as CSV or other format, as they
are now a text value.

"chipwood3" wrote:

I am trying to create a formula that will add a leading zerto to any number
that comes in with less than 5 digits. This is for a spreadsheet that will
carry over zip codes for a mailing. I want to know if I can write a formula
and if so, what it is that if a column of numbers just has 234 that the
formula will automatically add the two zeros making it 00234. Or if it is
2345 it will convert it to 02345.

Also - will the leading zeros (for lack of a better term) be hard coded so
that when you extor to a csv or another format, the zeros will remain.

Thanks
--
Chip

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Adding a leading zero "0" to a number in a cell

Select Number format then Number then Custom. Inset 5 zeros in the Type: Field.

I tested this in xl2007. Saving as a .csv file and then opened it with
Notepad and the leading zeros were there.



--
Regards,

OssieMac


"chipwood3" wrote:

I am trying to create a formula that will add a leading zerto to any number
that comes in with less than 5 digits. This is for a spreadsheet that will
carry over zip codes for a mailing. I want to know if I can write a formula
and if so, what it is that if a column of numbers just has 234 that the
formula will automatically add the two zeros making it 00234. Or if it is
2345 it will convert it to 02345.

Also - will the leading zeros (for lack of a better term) be hard coded so
that when you extor to a csv or another format, the zeros will remain.

Thanks
--
Chip

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
Adding data only if adjacent to cell labeled "male"/"female" lovesrubbaducky Excel Worksheet Functions 1 November 23rd 09 05:49 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
Problem with adding "+1" to one cell while another cell decreased by "1"? Michael Slater New Users to Excel 12 July 28th 07 01:06 AM
Adding "0" as leading digits into cells in Excel Tippetue Excel Worksheet Functions 2 October 19th 06 12:14 AM
how do I eliminate leading "0s" in an alpha numeric cell REST Excel Discussion (Misc queries) 1 September 14th 06 01:35 AM


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