+ Reply to Thread
Results 1 to 6 of 6

Thread: colour cell if data does not match a list

  1. #1
    Registered User
    Join Date
    10-24-2005
    MS-Off Ver
    2003
    Posts
    10

    colour cell if data does not match a list

    Hi

    This seems simple but I cannot get it to work (or maybe it's just late)

    I have a cell where data must be input. The data of that cell must match a list of 100 or so entries in another column. I would like the cell to show a message or color red if the data does not match that data set.

    data set is in form
    101-0012-NVY-10
    101-0013-GOA-12
    etc

    Any ideas?

    Thanks
    Mat
    Last edited by tuizner; 03-19-2010 at 04:46 PM.

  2. #2
    Forum Moderator Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2007
    Posts
    5,953

    Re: colour cell if data does not match a list

    Hi Mat, welcome to the forum - or at least your first post since you joined.

    You can use conditional formatting for this. For example if you want to format A1 based on whether or not it matches any value in B1:B100, open the Conditional Format window and create a new rule using this formula:

    =ISNUMBER(MATCH(A1,B1:B100,0))

    Click the Format button and choose a cell Fill/Pattern color (e.g. Red).

    Hope that helps!

  3. #3
    Registered User
    Join Date
    10-24-2005
    MS-Off Ver
    2003
    Posts
    10

    Re: colour cell if data does not match a list

    "=ISNUMBER(MATCH(A1,B1:B100,0))"


    Thanks Paul. I can see how that works for a cell but I am looking at a range and simply changing A1 to A1:A99 in the above does not work.

    In column A below I have input data. In column B I have set data. I need to highlight cells in column A when they do NOT match any of the data in column B. So A1 is OK as it matches B4 but the rest (A2:A8) should be highlighted.

    A ---------------------------------- B

    101-0002-AQU-12-----------101-0001-VAN-14
    sdfsdf----------------------------101-0001-VAN-16
    sfddsf----------------------------101-0002-AQU-10
    sdfs-------------------------------101-0002-AQU-12
    jhj
    hj
    hj
    hjhjhj

    Thanks again.
    Mat

  4. #4
    Forum Guru martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    10,785

    Re: colour cell if data does not match a list

    cf a1 as
    =isna(match(a1,$b$1:$b$100,0)) or =COUNTIF($B$1:$B$100,A1)=0
    then copy the format over the rest of cells in colA ,it will auto adjust to a2 a3 and so on
    Last edited by martindwilson; 03-11-2010 at 06:49 AM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and a dabbler in Cisco
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  5. #5
    Registered User
    Join Date
    10-24-2005
    MS-Off Ver
    2003
    Posts
    10

    Re: colour cell if data does not match a list

    Done it with the following:

    selecting column A and conditional formatting, create 2 formats, one covering text and the other covering numbers to make sure any error in cell A is picked up:

    =AND(ISTEXT(A1),A1<>$B$1:$B$999)
    =AND(ISNUMBER(A1),A1<>$B$1:$B$999)


    Thanks for the input Paul.
    Mat

  6. #6
    Registered User
    Join Date
    10-24-2005
    MS-Off Ver
    2003
    Posts
    10

    Re: colour cell if data does not match a list

    Thanks Martin

    Both of these work also - and are much more pretty than mine. Although I need to add a Zero to the data set to stop my input data column coming up highlighted this is easily achieved.

    Thanks for the assistance

+ 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.2.0