+ Reply to Thread
Results 1 to 7 of 7

Use formatting rules to require and restrict data in cells

Hybrid View

  1. #1
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,973

    Re: Use formatting rules to require and restrict data in cells

    Alpha validation is tricky. While ISERROR(LEFT(C2,2)+0) will return true for "AB" it will also return true for "A1", "?A" etc.

    Assuming only A-Z are allowed something like below for C2:C10 range.
    Formula: copy to clipboard
    =AND(MEDIAN(CODE(LEFT(C2,1)),65,90)=CODE(LEFT(C2,1)),MEDIAN(CODE(MID(C2,2,1)),65,90)=CODE(MID(C2,2,1)),ISNUMBER(RIGHT(C2,4)+0),LEN(C2)=6)
    "Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something."
    ― Robert A. Heinlein

  2. #2
    Forum Contributor
    Join Date
    05-01-2013
    Location
    Richmond, VA
    MS-Off Ver
    Excel 365
    Posts
    164

    Re: Use formatting rules to require and restrict data in cells

    Hello, this formula works for column C - I just modified it slightly to begin at cell C21. Thank you! That said, can you help with column B (which actually starts with B21)? I tried to modify what you provided for C as follows:

    =AND(MEDIAN(CODE(LEFT(B21,1)),65,90)=CODE(LEFT(B21,1)),MEDIAN(CODE(MID(B21,2,1)),65,90)=CODE(MID(B21,2,1)),ISNUMBER(RIGHT(B21,2)+0),LEN(B21)=4)

    However, I am sure I missed something. Column B example is: N1234 - First character is alpha value and the next four characters are numeric values.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Deleted Post
    By Hedy in forum Excel General
    Replies: 1
    Last Post: 08-30-2018, 03:28 PM
  2. Replies: 1
    Last Post: 08-31-2014, 03:38 PM
  3. Automatic formatting of cells based on rules/criteria
    By ioannes in forum Excel General
    Replies: 1
    Last Post: 07-30-2014, 03:55 AM
  4. Conditional formatting rules linking to cells
    By Mountain99 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-11-2013, 10:35 AM
  5. Replies: 1
    Last Post: 06-12-2013, 10:23 AM
  6. Replies: 2
    Last Post: 06-23-2011, 01:19 AM
  7. restrict with rules
    By mqdias in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-29-2006, 12:02 PM

Tags for this Thread

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