+ Reply to Thread
Results 1 to 10 of 10

Allow only one particular letter once in a group of cells

  1. #1
    Registered User
    Join Date
    12-08-2010
    Location
    Indiana
    MS-Off Ver
    Excel 2003
    Posts
    6

    Allow only one particular letter once in a group of cells

    I am trying to make this idiot proof. And I know what an idiot is. Me. I want to allow entry of only the letter x in 5 consecative cells. Once an x is placed in any of the 5 cells don't allow anything in the other 4 cells. Thanks in advance for your help.
    Last edited by bobrem; 12-09-2010 at 03:41 PM.

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Allow only one letter particular letter in a group of cells

    Let's say your working area is A2:E20. Select your working area and go to Data >Data validation
    Select Custom and type in this formula
    =COUNTIF($A2:$E2,"x")<2 Then OK

    If you want, modify your Error message to be more specific. Does that work for you?
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    12-08-2010
    Location
    Indiana
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Allow only one letter particular letter in a group of cells

    Thanks for the quick reply. Getting close I think. It works for "x" only. I want it to not allow any letter or number except "x" to be used. I am counting the number of "x's" so any other symbol isn't counted. Thanks.

  4. #4
    Registered User
    Join Date
    12-08-2010
    Location
    Indiana
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Allow only one letter particular letter in a group of cells

    I want to use this in validation. I want =COUNTIF($A1:$E1,"x")<2) so that only one "x" in any of the five cells will be allowed combined with (A1:E1="x") which allows only the letter "x" to be used. Thanks.

  5. #5
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Allow only one letter particular letter in a group of cells

    Use AND

    =AND(COUNTIF($A1:$E1,"x")<2), (A1:E1="x") ) How's that?

  6. #6
    Registered User
    Join Date
    12-08-2010
    Location
    Indiana
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Allow only one letter particular letter in a group of cells

    I thought that should work but it gives me an error message. I selected cells A1 to E1, validation, custom, pasted the formula and hit OK.

  7. #7
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Allow only one letter particular letter in a group of cells

    Try this
    =AND(COUNTIF($A1:$E1,"x")<2,COUNTIF($A1:$E1,"x")=COUNTA($A1:$E1))
    The second part says the # of x's is the same as the # of cells containing values.

  8. #8
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Allow only one letter particular letter in a group of cells

    Maybe this?

    =AND(A2="x",COUNTIF($A2:$E2,"x") <= 1)

    Error message
    Only one "x" allowed in any row
    Attached Files Attached Files
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  9. #9
    Registered User
    Join Date
    12-08-2010
    Location
    Indiana
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Allow only one particular letter once in a group of cells

    ChemistB you are wonderful. Worked perfect. Thank you so much.

  10. #10
    Registered User
    Join Date
    12-08-2010
    Location
    Indiana
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Allow only one particular letter once in a group of cells

    Marcol, that worked also. Big thanks.

+ 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