+ Reply to Thread
Results 1 to 22 of 22

Allow only letters in cell (no numbers)?

  1. #1
    Valued Forum Contributor
    Join Date
    02-26-2010
    Location
    Chattanooga, TN
    MS-Off Ver
    Excel 2003/2007/2010/2016
    Posts
    432

    Allow only letters in cell (no numbers)?

    Hello,

    How do I do data validation/cell formatting so that only alphabetic characters can be entered and no numbers?

    (We use the cell for First Name, Last Name, etc. and I don't want potential entries like Mr. 56565 55454 because the cells are formatted as text and allow alphabet and numbers.)

    I tried =NOT(ISNUMBER(H6)) for Data Validation, but that didn't work.

    ??

    VR/Lost
    Last edited by leaning; 10-07-2010 at 06:13 PM. Reason: Not completely solved!

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

    Re: Allow only letters in cell (no numbers)?

    Try perhaps custom formula:

    =A1=LEFT(A1,MIN(FIND(0,SUBSTITUTE(A1,{1,2,3,4,5,6,7,8,9},0)&0))-1)

    where A1 is top-left most cell in your selection to validate.
    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.

  3. #3
    Valued Forum Contributor
    Join Date
    02-26-2010
    Location
    Chattanooga, TN
    MS-Off Ver
    Excel 2003/2007/2010/2016
    Posts
    432

    Re: Allow only letters in cell (no numbers)?

    NBVC,

    I missed something somewhere.

    If the user is to input "Smith" into A1, where do I put your formula? As the Data Validation >Custom of A1?

    ?

    VR/Lost

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

    Re: Allow only letters in cell (no numbers)?

    Yes. The formula goes in the cell of the validation.. adjust the cell reference if necessary.

  5. #5
    Valued Forum Contributor
    Join Date
    02-26-2010
    Location
    Chattanooga, TN
    MS-Off Ver
    Excel 2003/2007/2010/2016
    Posts
    432

    Re: Allow only letters in cell (no numbers)?

    NBVC,

    Sorry to be a bother.

    For cell A1, Data Validation>Custom.

    Paste =LEFT(A1,MIN(FIND(0,SUBSTITUTE(A1,{1,2,3,4,5,6,7,8,9},0)&0))-1)

    I get the error You may not use unions, intersections, or array constants for Data Validation criteria.

    What am I doing wrong?

    VR/Lost

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Allow only letters in cell (no numbers)?

    Try =AND(ISERROR(FIND(ROW(INDIRECT("1:10")) - 1, A1)))
    Last edited by shg; 10-07-2010 at 05:53 PM. Reason: Oops ...
    Entia non sunt multiplicanda sine necessitate

  7. #7
    Valued Forum Contributor
    Join Date
    02-26-2010
    Location
    Chattanooga, TN
    MS-Off Ver
    Excel 2003/2007/2010/2016
    Posts
    432

    Talking Re: Allow only letters in cell (no numbers)?

    shg,

    That did it! Thanks!

    (But I don't know what I am going to do if 50 Cent becomes one of our customers.... )

    I love this group!

    VR/Lost

  8. #8
    Valued Forum Contributor
    Join Date
    02-26-2010
    Location
    Chattanooga, TN
    MS-Off Ver
    Excel 2003/2007/2010/2016
    Posts
    432

    Re: Allow only letters in cell (no numbers)?

    shg,

    I spoke too soon.

    ???&%# can still be entered.

    I guess I need to rename my post "Allow only letters in cell (and nothing else)"

    Can you do something to your formula like "A:Z" like you did "1:10" to not allow characters like ?$%, etc. ?

    ?

    VR/Lost

  9. #9
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Allow only letters in cell (no numbers)?

    Getting uglier

    =AND(MIN(CODE(MID(UPPER(A1), ROW(INDIRECT("1:" & LEN(A1))), 1))) > 65, MAX(CODE(MID(UPPER(A1), ROW(INDIRECT("1:" & LEN(A1))), 1))) < 90)

  10. #10
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Allow only letters in cell (no numbers)?

    another alternative might be

    Please Login or Register  to view this content.

  11. #11
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Allow only letters in cell (no numbers)?

    Well (harrumph), my formula has the distinct advantage of ... uh ... oops, phone is ringing, gotta go...

    EDIT -- but you should still put the INDIRECT in there ...

  12. #12
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Allow only letters in cell (no numbers)?

    Quote Originally Posted by shg View Post
    EDIT -- but you should still put the INDIRECT in there ...
    @shg - why do you say that ?

    incidentally I'm not advocating mine over others - it's not efficient in it's own right - though (at present) it's non-volatile...

  13. #13
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Allow only letters in cell (no numbers)?

    incidentally I'm not advocating mine over others
    Well, I would
    why do you say that ?
    Because without it, if you insert rows above row 90, the formula changes.

  14. #14
    Valued Forum Contributor
    Join Date
    02-26-2010
    Location
    Chattanooga, TN
    MS-Off Ver
    Excel 2003/2007/2010/2016
    Posts
    432

    Re: Allow only letters in cell (no numbers)?

    shg,

    I tried your code, but it doesn't allow "was", "fats" etc.

    (I don't know enough about how your formula is constructed to edit it.)

    So, "smith" and "jones" work fine; "richards" doesn't.

    ??

    VR/Lost

  15. #15
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Allow only letters in cell (no numbers)?

    Sorry, the comparson operators should include =:

    =AND(MIN(CODE(MID(UPPER(A1), ROW(INDIRECT("1:" & LEN(A1))), 1))) >= 65, MAX(CODE(MID(UPPER(A1), ROW(INDIRECT("1:" & LEN(A1))), 1))) <= 90)

    But I like DO's better:

    =SUM(LEN(A1) - LEN(SUBSTITUTE(UPPER(A1), CHAR(ROW(INDIRECT("65:90"))), ""))) = LEN(A1)
    Last edited by shg; 10-07-2010 at 08:40 PM.

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

    Re: Allow only letters in cell (no numbers)?

    And a smack on my wrists.. for not thinking about my formula giving that error... I didn't test it in data validation, I just came up with the formula and assumed "wrongly" that it would work in the data validation.. but data validation doesn't allow the array {...} ...

  17. #17
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Allow only letters in cell (no numbers)?

    Quote Originally Posted by shg
    EDIT -- but you should still put the INDIRECT in there ...
    Quote Originally Posted by D.O
    @shg - why do you say that ?
    Quote Originally Posted by shg View Post
    ...without it, if you insert rows above row 90, the formula changes.
    Fair point... I didn't think of that ... knowing me though I'd have used INDEX:INDEX

  18. #18
    Registered User
    Join Date
    08-20-2012
    Location
    Leominster, Ma
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Allow only letters in cell (no numbers)?

    In case anyone comes across this thread as I did, you can additionally limit the cell to a specific number of characters, which was my need.

    =and(len(a1)=2,SUM(LEN(a1) - LEN(SUBSTITUTE(UPPER(a1), CHAR(ROW(INDIRECT("65:90"))), ""))) = LEN(a1))

    A simpler but imperfect solution is:

    =and(istext(a1),len(a1)=2).

    The flaw is that it allows spaces and special characters to be entered.

    Have a blessed day.

    PS - If you also want to force them to be capital letters, use:
    =and(Exact(A1,upper(a1)),len(a1)=2,SUM(LEN(a1) - LEN(SUBSTITUTE(UPPER(a1), CHAR(ROW(INDIRECT("65:90"))), ""))) = LEN(a1))
    Last edited by Bert Uschold; 07-24-2014 at 04:13 PM. Reason: Add additional info.

  19. #19
    Registered User
    Join Date
    07-11-2017
    Location
    DALLAS, TX
    MS-Off Ver
    2010
    Posts
    1

    Re: Allow only letters in cell (no numbers)?

    The above formula is EXACTLY what I need ... I only need one minor adjustment.
    Is there any way at all to do this same exact thing, but allow spaces?

    Meaning: In a "Last Name" Field, the Entry 'SMITH-JONES' would return ERROR but 'SMITH JONES' is allowed

    I need numbers and special characters to remain on lockdown but need to allow the space between a hyphenated name.

    Is this possible?

    Thank you!

  20. #20
    Forum Expert avk's Avatar
    Join Date
    07-12-2007
    Location
    India
    MS-Off Ver
    Microsoft Office 2013
    Posts
    3,223

    Re: Allow only letters in cell (no numbers)?

    If your data in "A1"
    Try with this in "B1"
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    atul


    If my answer (or that of other members) has helped you, please say "Thanks" by clicking the Add Reputation button at the foot of one of their posts.

    Also: if your problem is solved, please take the time to mark your thread as SOLVED by going to the top of your first post, selecting "Thread Tools" and then "Mark thread as solved".

  21. #21
    Forum Contributor
    Join Date
    03-12-2014
    Location
    Riyadh
    MS-Off Ver
    Office 365
    Posts
    129

    Re: Allow only letters in cell (no numbers)?

    Hello avk & Guys! thank you. the last post is great and the formula works nicely.
    Last edited by saudi_red_neck; 06-13-2019 at 02:43 AM.

  22. #22
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: Allow only letters in cell (no numbers)?

    Quote Originally Posted by saudi_red_neck View Post
    Hello avk & Guys! thank you. the last post is great and the formula works nicely. However, can you please help me tweak it more?

    I noticed that the formula allows: double or more spaces (between characters) And leading And Trailing spaces. I wish the result to be false if any of the last 3 occur.

    Thank you very much in advance
    Administrative Note:

    Welcome to the forum.

    We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original. Please start a new thread - See Forum rule #4

    If you are not familiar with how to start a new thread see the FAQ: How to start a new thread
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ 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