+ Reply to Thread
Results 1 to 4 of 4

Excel 2007 : Validation of ID number

Hybrid View

  1. #1
    Registered User
    Join Date
    02-05-2010
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    2

    Validation of ID number

    Im having a bit of trouble trying to find the right formula for validating an ID number for Customer ID, which is C0000001 to C9999999

    I tried going into the help section and experimented with the formula there but I cant get it to work. I also need to use the validation of different IDs such as S001 to S999.

    Help would be appreciated. Thanks.
    Last edited by john1980; 02-05-2010 at 11:45 PM.

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885

    Re: Validation of ID number

    Hi John, welcome to the forum.

    For the first validation, try the following Custom formula:

    =AND(LEFT(A1,1)="C",ISNUMBER(RIGHT(A1,7)+0),LEN(A1)=8)

    LEFT(A1,1)="C" checks to see if the first character is a C
    ISNUMBER(RIGHT(A1,7)+0) checks to see if the last 7 characters constitutes a number (if there's any letters in there, it will fail)
    LEN(A1)=8 checks to make sure the cell value is 8 characters long (1 letter + 7 digits)

    The same method can be applied for S001 to S999, just change the three sections appropriately.

  3. #3
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Validation of ID number

    Also, if you want to ensure the "C" is upper case:

    =AND(EXACT(LEFT(A1,1),UPPER("C")),ISNUMBER(RIGHT(A1,7)+0),LEN(A1)=8)
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  4. #4
    Registered User
    Join Date
    02-05-2010
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Validation of ID number

    Great it works.
    Thanks paul for explaining what each part of the formula does.
    Thanks NBVC for the tip.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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