+ Reply to Thread
Results 1 to 9 of 9

Limit number of characters in a cell

  1. #1
    Forum Contributor
    Join Date
    05-29-2009
    Location
    Chattanooga, TN
    MS-Off Ver
    2021
    Posts
    205

    Limit number of characters in a cell

    I want to limit the number of characters that can be put into a cell to be 20.

    Is it possible when character count exceeds 20, disable input into the cell and trigger a pop-up message that shows how many characters I'm attempting to input into a cell?

    If that is not possible, how can I conditional format to change to a color when character count limit is exceeded?

    thanks!
    Last edited by Ocean Zhang; 04-19-2013 at 02:56 AM.

  2. #2
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,646

    Re: Limit number of characters in a cell

    Using Data Validation for the cell, i.e A1:
    Data/Data Validation:
    In Setting tab:

    Allow: Text length
    Data: less than or equal to
    Maximum:20

    In other tabs: for warning messages
    Quang PT

  3. #3
    Forum Contributor
    Join Date
    05-29-2009
    Location
    Chattanooga, TN
    MS-Off Ver
    2021
    Posts
    205

    Re: Limit number of characters in a cell

    thanks for that suggestion. It works great if I type in the cell, but still lets me paste an invalid value into the cell. Is there another option?

    What formula would I use in the conditional format section to highlight cells greater than X character length?

    thanks

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Limit number of characters in a cell

    The paste operation is a drawback of validation.

    You could use an event macro if you can get someone to write the code (I'm not much of a programmer).

    Here's how to use conditional formatting to highlight cells with more than 20 characters.

    Let's assume you want to apply this to the range A2:A10.

    Select the *entire* range A2:A10 starting from cell A2.
    Cell A2 will be the active cell. The active cell is the
    one cell in the selected range that is not shaded. The
    formula will be relative to the active cell.

    Goto the Home tab>Styles>Conditional Formatting>
    Manage rules>New rule>Use a formula to determine
    which cells to format

    Enter this formula in the box below:

    =LEN(A2)>20

    Click the Format button
    Select the desired style(s)
    OK out
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  5. #5
    Forum Contributor
    Join Date
    05-29-2009
    Location
    Chattanooga, TN
    MS-Off Ver
    2021
    Posts
    205

    Re: Limit number of characters in a cell

    thanks for the quick responses!!!

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Limit number of characters in a cell

    You're welcome!

  7. #7
    Valued Forum Contributor Neil_'s Avatar
    Join Date
    04-19-2013
    Location
    Yorkshire
    MS-Off Ver
    Office 365 Enterprise E3 2013 / 2016
    Posts
    479

    Re: Limit number of characters in a cell

    the validation answer is the way to go.
    Link here to disable paste
    http://www.mrexcel.com/forum/excel-q...ste-excel.html
    Last edited by Neil_; 04-19-2013 at 11:22 AM.

  8. #8
    Forum Contributor
    Join Date
    05-29-2009
    Location
    Chattanooga, TN
    MS-Off Ver
    2021
    Posts
    205

    Re: Limit number of characters in a cell

    Neil, thanks for your input. Great to know! But I don't want to disable copy/cut paste for the entire worksheet. I only want to disable for certain columns. Is that possible?

  9. #9
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Limit number of characters in a cell

    You'll also have to disable drag and drop. That's another drawback of validation!

+ 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