+ Reply to Thread
Results 1 to 4 of 4

Data Validation exactly 10 numbers including leading 0's

  1. #1
    Registered User
    Join Date
    08-30-2016
    Location
    Toronto, CA
    MS-Off Ver
    excel 2010
    Posts
    6

    Data Validation exactly 10 numbers including leading 0's

    Hi All,

    I'm new to this forum. I was hoping someone can help me with an issue i'm having.

    I'm trying to make a column where users can input an account number. This account number has 3 (or sometimes 4 or 5) leading zeros. All account numbers are exactly 10 numbers long and the zeros must be visible in the cell. I'd like the data validation to stop anything else typed in if it does not follow these rules. (ex. 0001234567). I have excel 2010. Thanks.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,525

    Re: Data Validation exactly 10 numbers including leading 0's

    A combobox from the controls tool bar would work better as it has autocomplete

  3. #3
    Registered User
    Join Date
    08-30-2016
    Location
    Toronto, CA
    MS-Off Ver
    excel 2010
    Posts
    6

    Re: Data Validation exactly 10 numbers including leading 0's

    Hi,

    Thank you for your reply. Is there anyway to do this with Data Validation? Essentially all I need is the cell to only allow users to input numbers that are exactly 10 digits long and to show any leading zeros.

    Thanks,

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Data Validation exactly 10 numbers including leading 0's

    You will have to preformat the target cell(s) as TEXT to allow leading zeros.

    Data Validation
    Allow: Custom
    Formula:

    =AND(LEN(A1)=10,COUNT(-MID(A1,ROW(INDIRECT("1:10")),1))=10)

    If you test that formula on the worksheet it must be array entered.

    Array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Including leading zeros in a time function
    By chakyt in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-09-2015, 09:13 AM
  2. Data Validation including formatting from source list
    By k_krishna in forum Excel General
    Replies: 2
    Last Post: 08-13-2014, 09:32 AM
  3. Data Validation - Leading Zeros
    By RogueArchon in forum Excel General
    Replies: 7
    Last Post: 05-23-2014, 01:19 PM
  4. VBA to create Data Validation (including Offset and Match)
    By matt4003 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-04-2013, 10:02 AM
  5. Replies: 1
    Last Post: 09-28-2012, 03:40 PM
  6. convert excel to html including data validation
    By imatthews2001 in forum Excel General
    Replies: 0
    Last Post: 09-03-2011, 06:45 AM
  7. Replies: 1
    Last Post: 08-03-2005, 03:05 PM

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