+ Reply to Thread
Results 1 to 4 of 4

Thread: validating a text and numeric input string

  1. #1
    Registered User
    Join Date
    07-30-2007
    Posts
    61

    Question validating a text and numeric input string

    Hi

    Please could someone help with the following

    I need to validate what is being inputted into a cell, via a Input Box

    If the input is 2 letters followed by 7 number then it is ok, otherwise they need to enter it again

    AB1234567 - OK
    anything esle - Not OK

    thanks

    roast

  2. #2
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636
    If you are entering directly into a cell, then you can use Data|Validation..

    choose Custom and enter formula:

    =AND(LEN(G7)=9,NOT(ISNUMBER(LEFT(G7,2)+0)),ISNUMBER(RIGHT(G7,7)+0))

    Where G7 is the cell to validate.
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

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

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

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  3. #3
    Registered User
    Join Date
    07-30-2007
    Posts
    61
    Quote Originally Posted by NBVC View Post
    If you are entering directly into a cell, then you can use Data|Validation..

    choose Custom and enter formula:

    =AND(LEN(G7)=9,NOT(ISNUMBER(LEFT(G7,2)+0)),ISNUMBER(RIGHT(G7,7)+0))

    Where G7 is the cell to validate.
    thanks

    will this work in VBA? or is further code required?

  4. #4
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636
    You will need more code, but I am not a VBA guy...sorry.

    Someone else can help..
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

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

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

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

+ 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. Is it possible to give cell text a numeric value?
    By billybob013 in forum Excel General
    Replies: 10
    Last Post: 02-27-2012, 10:57 PM
  2. Numeric value from a text string/numeric identifier?
    By lampshell in forum Excel Worksheet Functions
    Replies: 2
    Last Post: 05-14-2008, 02:21 PM
  3. Using a countif function for text string data.
    By Stevie-B in forum Excel Worksheet Functions
    Replies: 14
    Last Post: 03-11-2008, 11:54 AM
  4. Assign a numeric value to a text string
    By AndyC8 in forum Excel General
    Replies: 3
    Last Post: 11-29-2006, 08:27 AM
  5. Replies: 2
    Last Post: 10-25-2006, 11:45 PM

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.2.0