+ Reply to Thread
Results 1 to 7 of 7

Allowing certain things in a cell

Hybrid View

  1. #1
    Registered User
    Join Date
    07-14-2006
    Posts
    50

    Question Allowing certain things in a cell

    Hi All,
    Thanks for all those who helped on other threads.

    I have a new problem.

    In column A i would the cells to only be to contain a certain kind of text...
    e.g

    A Letter, A Letter, A Number, A Number, A Number, A Number, A Number & A Number
    (AA123456).

    This is what will be entered in most cases but there may be the odd one that needs to be different. Ideally i would like a warning message to appear and say "this is not the standard...do you want to continue" so different enteries are allowed but the inputter is made aware its not the same.

    Im guessing its going to be done under Data>Validation but not sure exactly what.

    Any help would be great.

    Thanks in advance,

    Emma x

  2. #2
    Forum Contributor
    Join Date
    02-28-2006
    Posts
    690
    can you use column B for the message?

    if so you could check if LEFT(A1,1) is between A and Z and the same check for MID(A1,2,1)

    MID(A1,3,1) and so on would be checked for values between 0 and 9

    OR

    RIGHT(A1,6) is between 0 and 999999

  3. #3
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885
    To use Data Validation, which I'd recommend, use the Custom formula:
    =AND(NOT(ISNUMBER(LEFT(A1,2))),ISNUMBER(VALUE(RIGHT(A1,6))))
    This checks to see if the first two characters are letters, and the last six characters are numbers. If not a warning message appears asking the user to continue or not.

  4. #4
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885
    After further testing, use the following custom formula:
    =AND(LEN(A1)=8,NOT(ISNUMBER(VALUE(LEFT(A1,1)))),NOT(ISNUMBER(VALUE(MID(A1,2,1)))),ISNUMBER(VALUE(RIGHT(A1,6))))
    This checks the first and second characters separately, then the last six; and it checks the length of the string to make sure it is 8. (Otherwise CBS12345678 would also pass the validation test even though it's too long.)

  5. #5
    Registered User
    Join Date
    07-14-2006
    Posts
    50
    robert111 : thanks for the help but column B is already in use and I cant hide columns or things like that in this sheet. Thank you anyway

    pjoaquin : thanks for this. Ill go and try it now but no doubt it will work. Thanks again

  6. #6
    Registered User
    Join Date
    07-14-2006
    Posts
    50
    pjoaquin : this works fine...but how things can change in a matter of moments.

    Now i need it to be

    AA123456A

    (adding the extra letter at the end)...

    Any easy amendments? I did fiddle with the formula but couldnt get it working.

    Thanks

    Emma x

+ 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