+ Reply to Thread
Results 1 to 8 of 8

Data Validation - Leading Zeros

  1. #1
    Registered User
    Join Date
    02-14-2012
    Location
    Rochester, NY
    MS-Off Ver
    Excel 2010
    Posts
    20

    Data Validation - Leading Zeros

    Hello!

    I'm trying to add data validation to a cell designated for Zip codes. I have no problem getting the data validation to prevent entry of anything but 5 numerical digits...except when the first digit is zero.

    I've tried everything I can think of, and I can't get it to recognize that first zero as a number. I even tried formatting the cell with a custom "00000" number format. Currently the validation looks like this:

    =AND(ISNUMBER(F24),LEN(F24)=5)

    Does anyone know a trick to make Excel recognize the first zero?

    Thanks in advance!
    RA

  2. #2
    Forum Expert DGagnon's Avatar
    Join Date
    02-23-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003, 2007
    Posts
    1,645

    Re: Data Validation - Leading Zeros

    try using the data validation requiring a whole number, and set it to less than 100000. then you can format that cell using the zip code format and you should get the results you are looking for.
    If you liked my solution, please click on the Star -- to add to my reputation

    If your issue as been resolved, please clearly state so and mark the thread as [SOLVED] using the thread tools just above the first post.

  3. #3
    Forum Expert DGagnon's Avatar
    Join Date
    02-23-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003, 2007
    Posts
    1,645

    Re: Data Validation - Leading Zeros

    or since the lowest possible ZIP code is 01001, you could use whole number between 1001 and 99999, with the formating as described above.

  4. #4
    Registered User
    Join Date
    02-14-2012
    Location
    Rochester, NY
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Data Validation - Leading Zeros

    Fantastic! Thank you

    I actually tried something like this, but I just set it to a between 0-99999, which naturally would have allowed "123". I didn't even consider checking to see what the lowest zip code is. Cheers!

  5. #5
    Forum Expert DGagnon's Avatar
    Join Date
    02-23-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003, 2007
    Posts
    1,645

    Re: Data Validation - Leading Zeros

    no problem, glad i could help.

  6. #6
    Forum Contributor darknation144's Avatar
    Join Date
    01-24-2012
    Location
    London
    MS-Off Ver
    Microsoft Excel 365 MSO
    Posts
    555

    Re: Data Validation - Leading Zeros

    Please mark this as solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

  7. #7
    Registered User
    Join Date
    05-23-2014
    Posts
    1

    Re: Data Validation - Leading Zeros

    I don't know anything about commands to enter for data validation, so can anyone give me a dummy-downed hand with the following? I need to enter 8 digit strings in a column; the first 2 digits and last 6 digits need to be seperated by a dash mark (example: 04-982701 or AA-540120). I was fine until I had to enter a number that started with a zero or a letter. Thanks so much!
    Last edited by alyce; 05-23-2014 at 11:31 AM.

  8. #8
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Data Validation - Leading Zeros

    Alyce, it is against forum rules to post a question on another poster's thread. Feel free to start your own then any replies will be tailored to your needs.
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1