+ Reply to Thread
Results 1 to 10 of 10

Thread: Data Validation

  1. #1
    Registered User
    Join Date
    08-16-2011
    Location
    Edmonton, Canada
    MS-Off Ver
    Excel 2010
    Posts
    20

    Data Validation

    Hi,

    I'm trying to restrict entry into cells by other users, in that they can only insert alphabet characters (no numbers or characters /,*, &, etc.). I've come across the following formula:

    Is Null OR Not Like "*[!a-z]*"

    It works, but doesn't allow spaces....how can I format this to allow spaces in the entries?

    Thanks,

    Christina

  2. #2
    Valued Forum Contributor tlafferty's Avatar
    Join Date
    04-08-2011
    Location
    United States, Tacoma, WA
    MS-Off Ver
    Excel 2010
    Posts
    856

    Re: Excel Data Validation

    If you're evaluating Cell A1:
    =OR(CODE(A1)=32,AND(CODE(A1)>=97,CODE(A1)<=122))
    Copy and paste validation as needed.
    If your question has been satisfactorily addressed, please consider marking it solved. Click here to see how.

    Also, you might want to add to the user's reputation by clicking the scales icon - it's why we do what we do...

    Thomas Lafferty
    Analyst/Programmer

  3. #3
    Forum Guru shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2007, 2010
    Posts
    25,777

    Re: Data Validation

    You mean validation via VBA?
        With Range("A1")
            If Not .Value Like "*[!A-Za-z ]*" Then MsgBox "Ok"
        End With
    Microsoft MVP - Excel
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Registered User
    Join Date
    08-16-2011
    Location
    Edmonton, Canada
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Data Validation

    Hi,

    I was actually just hoping to use the data validation function in Excel, rather than code. I have a complicated macro already running on that spreadsheet, and was hoping to find a more simplistic way to accomplish this through the data validation feature.

  5. #5
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,640

    Re: Data Validation

    Is Null OR Not Like "*[!a-z]*"
    How did you get that to work then? That is not a formula and cannot be used in Data Validation (I didn't think so anyways)... it can be used in VBA as Shg has shown.
    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.

  6. #6
    Forum Guru snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,151

    Re: Data Validation

    In a macromodule:

     
    Function tst(c01 As Range) As Boolean
      tst = not c01.Value Like "*[!A-Za-z ]*"
    End Function
    put this formula in C1: "=tst(B1)

    Datavalidation of B1 (adapted) : "=C1"
    Attached Files Attached Files
    Last edited by snb; 08-30-2011 at 11:33 AM.



  7. #7
    Registered User
    Join Date
    08-16-2011
    Location
    Edmonton, Canada
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Data Validation

    Hm, it seemed to work when I used the Data Validation feature, selected "custom" and was asked to enter a formula...seemed more straight forward to me.

  8. #8
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,640

    Re: Data Validation

    Hmm.. interesting, maybe that is something I never knew you could do?

    What exactly did you put in as the actual "working" formula in data Validation?

    I entered: Not Like "*[!a-z]*" and it accepted it, but it would error out with anything I tried to enter into the cell.

    I guess that formula would allow only single letter entries, no special characters, right?
    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.

  9. #9
    Registered User
    Join Date
    08-29-2011
    Location
    Wisbech England
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Data Validation

    Hi I was wondering if is possible to create something like this :drop down list with product names, after product is selected from the drop down list it will automatically fill the cells A8,B8,C8,D8,E8 with the settings so I could set a data validation in case if an employee enters incorrect data. This is my first post and I apologize if this post is confusing.
    Thanks in advance

    Dan

  10. #10
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,640

    Re: Data Validation

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread.
    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)

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