Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 162
Default Function to Count Zip Code Digits With Leading Zero

Hello,

I have a zip code as 06110 formatted as zip code. I used LEN on that zip
code and it returns a 4 because it's not reading the leading zero. Is there
a function that will return a value of 5 for a zip code with a leading zero
and still be able to return a value of 5 for zip codes that have 5 digits?
Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,651
Default Function to Count Zip Code Digits With Leading Zero

You would need to enter the data as text. Numbers are stored without
leading zeroes.
You could, of course, use =LEN(TEXT(A2,"00000")) That will return 5 for
integers up to and including 5 digits, but will allow numbers longer than 5
digits to be counted as longer.
--
David Biddulph

"Daren" wrote in message
...
Hello,

I have a zip code as 06110 formatted as zip code. I used LEN on that zip
code and it returns a 4 because it's not reading the leading zero. Is
there
a function that will return a value of 5 for a zip code with a leading
zero
and still be able to return a value of 5 for zip codes that have 5 digits?
Thanks!



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 527
Default Function to Count Zip Code Digits With Leading Zero



"Daren" wrote:

Hello,

I have a zip code as 06110 formatted as zip code. I used LEN on that zip
code and it returns a 4 because it's not reading the leading zero. Is there
a function that will return a value of 5 for a zip code with a leading zero
and still be able to return a value of 5 for zip codes that have 5 digits?
Thanks!


Daren

The problem with a zip code format is just that, it changes the way a number
looks so len will ignore a leading zero and LEN(12.00) will always be 2.

You can convert the number to text with a helper column and then copy and
paste special the values over the formulas and then cut and past them into
the zip codes.

if your zip is in A6 use; =IF(LEFT(A6,1)="0",A6,"0"&A6) and copy down.

Regards
Peter Atherton
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,934
Default Function to Count Zip Code Digits With Leading Zero

If you have the cell formatted as Zip Code, why are you checking its length
at all? Wouldn't all your zip codes have to be 5 characters long with that
format? Or are you putting something else besides zip codes in a cell
formatted as Zip Code? If that is what you are doing, then what other
entries can there be?

--
Rick (MVP - Excel)


"Daren" wrote in message
...
Hello,

I have a zip code as 06110 formatted as zip code. I used LEN on that zip
code and it returns a 4 because it's not reading the leading zero. Is
there
a function that will return a value of 5 for a zip code with a leading
zero
and still be able to return a value of 5 for zip codes that have 5 digits?
Thanks!


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
Truncate leading digits of large number adamp Excel Discussion (Misc queries) 1 June 18th 08 06:35 PM
zero fill leading digits RLB Excel Discussion (Misc queries) 1 March 7th 07 05:59 AM
Validation rule - custom 5 digits w/ leading zeroes jennifer Excel Worksheet Functions 1 March 27th 06 12:49 AM
Leading digits Brent E Excel Discussion (Misc queries) 5 May 31st 05 10:08 AM
how do you display a zip code with a leading zero nicole Excel Discussion (Misc queries) 2 January 25th 05 12:18 AM


All times are GMT +1. The time now is 04:20 AM.

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"