+ Reply to Thread
Results 1 to 5 of 5

Data validation to prevent use of a character

  1. #1
    Forum Contributor Rick_Stanich's Avatar
    Join Date
    11-21-2005
    Location
    Ladson SC
    MS-Off Ver
    Office365
    Posts
    1,167

    Data validation to prevent use of a character

    It may seem strange to you, but I have my insanity, I mean, my reasons for this post.

    I wish to prevent the use of the " ' " apostrophe in an entire column and I was wondering if this can be done with conditional formatting including a message of some type.
    Last edited by Rick_Stanich; 11-13-2009 at 02:19 PM.
    Regards

    Rick
    Win10, Office 365

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885

    Re: Conditional formatting to prevent use of a character

    Hi Rick,

    You can't use Conditional Formatting to prevent someone from using a character, but you can use Data Validation to do so.

    For example, to prevent a user from using the apostrophe in cell A1, select that cell and open the Data Validation dialog. Select Custom and use the following formula:

    =ISERROR(FIND("'",A1))

    On the Error Alert tab, check the box for "Show error alert...", set the Style to Stop and then enter a custom message/title to show to the user when the validation is triggered because they typed an apostrophe.

    Hope that helps!

  3. #3
    Forum Contributor Rick_Stanich's Avatar
    Join Date
    11-21-2005
    Location
    Ladson SC
    MS-Off Ver
    Office365
    Posts
    1,167

    Re: Conditional formatting to prevent use of a character

    What the heck?
    I test your example in A1 and it works. I attempt to apply to column D and it doesnt work.
    The only change I made to the formula was A1 to D:D
    =ISERROR(FIND("'",D:D))
    Is that not allowed?

  4. #4
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885

    Re: Conditional formatting to prevent use of a character

    It's not allowed to use FIND over an entire column. Instead, select column D and then set the formula to:

    =ISERROR(FIND("'",D1))

    Just like with formulas directly on the worksheet, this validation formula will change for every row selected. So if you look at the data validation formula for D820, it will show

    =ISERROR(FIND("'",D820))

    This should prevent them from typing an apostrophe in any cell in column D.

  5. #5
    Forum Contributor Rick_Stanich's Avatar
    Join Date
    11-21-2005
    Location
    Ladson SC
    MS-Off Ver
    Office365
    Posts
    1,167

    Re: Data validation to prevent use of a character (Was Conditinal formatting)

    Lesson learned, thank you.

+ 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