#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,696
Default Keep Leading Zero

This has to be an easy one, but I can't find it. How do I retain the leading
zero in a number and retain number formatting?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,173
Default Keep Leading Zero

Sean

If these are the same length (say six characters) go to
FormatCells...Custom and enter 000000

Otherwise, your stuck with text formatting or a leading apostrophe (same
thing really)

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
www.nickhodge.co.uk


"Sean Timmons" wrote in message
...
This has to be an easy one, but I can't find it. How do I retain the
leading
zero in a number and retain number formatting?


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,393
Default Keep Leading Zero

To display 123 as 0123 use the custom format "0000" (no quotes, of course)
happy new year
--
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email

"Sean Timmons" wrote in message
...
This has to be an easy one, but I can't find it. How do I retain the
leading
zero in a number and retain number formatting?



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Keep Leading Zero

Say you have a number like 01234 - a total for five digits.

Format Cells... Number Custom and make it 00000

You will always get the leading zero, even if you only entered 4 digits.
--
Gary's Student


"Sean Timmons" wrote:

This has to be an easy one, but I can't find it. How do I retain the leading
zero in a number and retain number formatting?

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 103
Default Keep Leading Zero

On Wed, 27 Dec 2006 12:41:01 -0800, Sean Timmons
wrote:

This has to be an easy one, but I can't find it. How do I retain the leading
zero in a number and retain number formatting?


Two ways typically:
- The most common is to format the cell as Text. (Format- Cells -
Text)
- Another less common one is to use the custom format 0########, where
you put as many hash signs as the maximum expected width of the entry.

(I have no idea what that is in Excel 2007's "ribbons" or whatever the
hell they are, nor do I much want to at this point.)

---------------------------------------------------------
Hank Scorpio
scorpionet who hates spam is at iprimus.com.au (You know what to do.)
* Please keep all replies in this Newsgroup. Thanks! *


  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,393
Default Keep Leading Zero

You can also enter the 'number' as 'o123 (leading quote, and then right
justify it
This will still 'function' as a numeric value
--
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email

"Sean Timmons" wrote in message
...
This has to be an easy one, but I can't find it. How do I retain the
leading
zero in a number and retain number formatting?



  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 103
Default Keep Leading Zero

On Wed, 27 Dec 2006 17:10:21 -0400, "Bernard Liengme"
wrote:

You can also enter the 'number' as 'o123 (leading quote, and then right
justify it
This will still 'function' as a numeric value


I think you mean '0123, rather than 'o123.

(The number '0' will still let the value be used in calculations when
the entry's in text format (including formatting it that way by using
a leading quote mark as above), but the letter 'o' doesn't.)

---------------------------------------------------------
Hank Scorpio
scorpionet who hates spam is at iprimus.com.au (You know what to do.)
* Please keep all replies in this Newsgroup. Thanks! *
  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Keep Leading Zero

My Excel 2003 does not recognize a string such as '0123 as a numeric.

Could either of you two gentlemen explain how the string as above can funtion in
calculations "as is"?


Gord


On Thu, 28 Dec 2006 09:11:18 +1100, Hank Scorpio wrote:

On Wed, 27 Dec 2006 17:10:21 -0400, "Bernard Liengme"
wrote:

You can also enter the 'number' as 'o123 (leading quote, and then right
justify it
This will still 'function' as a numeric value


I think you mean '0123, rather than 'o123.

(The number '0' will still let the value be used in calculations when
the entry's in text format (including formatting it that way by using
a leading quote mark as above), but the letter 'o' doesn't.)

---------------------------------------------------------
Hank Scorpio
scorpionet who hates spam is at iprimus.com.au (You know what to do.)
* Please keep all replies in this Newsgroup. Thanks! *


  #9   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Keep Leading Zero

I think it depends on what you do with that cell:

With '0123 in A1:
=a1+5
returns 128

=sum(a:a)
won't include 123 in that sum.

Gord Dibben wrote:

My Excel 2003 does not recognize a string such as '0123 as a numeric.

Could either of you two gentlemen explain how the string as above can funtion in
calculations "as is"?

Gord

On Thu, 28 Dec 2006 09:11:18 +1100, Hank Scorpio wrote:

On Wed, 27 Dec 2006 17:10:21 -0400, "Bernard Liengme"
wrote:

You can also enter the 'number' as 'o123 (leading quote, and then right
justify it
This will still 'function' as a numeric value


I think you mean '0123, rather than 'o123.

(The number '0' will still let the value be used in calculations when
the entry's in text format (including formatting it that way by using
a leading quote mark as above), but the letter 'o' doesn't.)

---------------------------------------------------------
Hank Scorpio
scorpionet who hates spam is at iprimus.com.au (You know what to do.)
* Please keep all replies in this Newsgroup. Thanks! *


--

Dave Peterson
  #10   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 103
Default Keep Leading Zero

On Wed, 27 Dec 2006 17:30:58 -0600, Dave Peterson
wrote:

I think it depends on what you do with that cell:

With '0123 in A1:
=a1+5
returns 128

=sum(a:a)
won't include 123 in that sum.


Yup, what Dave said. Though I confess that I didn't check it beyond
simple arithmetic opertations because "leading 0" typically means
telephone or credit card numbers or similar, which generally don't
have calculations performed on them. The fact that you can, in some
cases, do so is really only an aside.

Gord Dibben wrote:

My Excel 2003 does not recognize a string such as '0123 as a numeric.

Could either of you two gentlemen explain how the string as above can funtion in
calculations "as is"?

Gord


---------------------------------------------------------
Hank Scorpio
scorpionet who hates spam is at iprimus.com.au (You know what to do.)
* Please keep all replies in this Newsgroup. Thanks! *


  #11   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Keep Leading Zero

Thanks Dave

I tested using 5 of the Functions from the AutoSum drop-down and '0123 was not a
valid numeric.

Did not realize a simple =cellref + 5 would add correctly.


Gord

On Wed, 27 Dec 2006 17:30:58 -0600, Dave Peterson
wrote:

I think it depends on what you do with that cell:

With '0123 in A1:
=a1+5
returns 128

=sum(a:a)
won't include 123 in that sum.

Gord Dibben wrote:

My Excel 2003 does not recognize a string such as '0123 as a numeric.

Could either of you two gentlemen explain how the string as above can funtion in
calculations "as is"?

Gord

On Thu, 28 Dec 2006 09:11:18 +1100, Hank Scorpio wrote:

On Wed, 27 Dec 2006 17:10:21 -0400, "Bernard Liengme"
wrote:

You can also enter the 'number' as 'o123 (leading quote, and then right
justify it
This will still 'function' as a numeric value

I think you mean '0123, rather than 'o123.

(The number '0' will still let the value be used in calculations when
the entry's in text format (including formatting it that way by using
a leading quote mark as above), but the letter 'o' doesn't.)

---------------------------------------------------------
Hank Scorpio
scorpionet who hates spam is at iprimus.com.au (You know what to do.)
* Please keep all replies in this Newsgroup. Thanks! *


Gord Dibben MS Excel MVP
  #12   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Keep Leading Zero

Thanks Hank.

I posted a reply to Dave also.


Gord

On Thu, 28 Dec 2006 11:00:28 +1100, Hank Scorpio wrote:

On Wed, 27 Dec 2006 17:30:58 -0600, Dave Peterson
wrote:

I think it depends on what you do with that cell:

With '0123 in A1:
=a1+5
returns 128

=sum(a:a)
won't include 123 in that sum.


Yup, what Dave said. Though I confess that I didn't check it beyond
simple arithmetic opertations because "leading 0" typically means
telephone or credit card numbers or similar, which generally don't
have calculations performed on them. The fact that you can, in some
cases, do so is really only an aside.

Gord Dibben wrote:

My Excel 2003 does not recognize a string such as '0123 as a numeric.

Could either of you two gentlemen explain how the string as above can funtion in
calculations "as is"?

Gord


---------------------------------------------------------
Hank Scorpio
scorpionet who hates spam is at iprimus.com.au (You know what to do.)
* Please keep all replies in this Newsgroup. Thanks! *


Gord Dibben MS Excel MVP
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
Display leading zeros in numeric value without converting to text Gmonny Excel Discussion (Misc queries) 4 October 5th 06 09:05 PM
Leading zeroes get dropped when converted to text Jason Grunert Excel Discussion (Misc queries) 8 August 4th 06 09:42 PM
Keeping leading 0's CLR Excel Discussion (Misc queries) 3 March 3rd 06 10:45 PM
Leading Zeros Karen Excel Discussion (Misc queries) 3 January 10th 06 09:50 PM
Remove leading space Karidre Excel Worksheet Functions 4 October 24th 05 03:39 PM


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