+ Reply to Thread
Results 1 to 4 of 4

Conditional formatting using VLOOKUP

  1. #1
    Registered User
    Join Date
    03-13-2010
    Location
    Birmingham, England
    MS-Off Ver
    Excel 2003
    Posts
    6

    Question Conditional formatting using VLOOKUP

    Hi all

    Using Excel 2007 and trying to see if I can do the following.

    In sheet 1 I have a list of postcodes and in sheet 2 I have a list of postcodes with a name marked against each one. I'm trying to change the colour of the postcode in sheet 1 based on who the postcode is assigned to e.g. if Bill has the North London postcode, I want the background to be blue.

    The formula I'm using in the conditional formatting box is this:

    VLOOKUP(A1,Sheet2!A1:B127,2,FALSE)="Bill"

    Excel then converts this into ="VLOOKUP(A1,Sheet2!1:B127,2,FALSE)=""Bill"""

    Any ideas where I'm going wrong?

    Many thanks.

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Conditional formatting using VLOOKUP

    1. you cant use references to other work sheets in cf like that
    2.you are putting it in wrong any way
    you need to put the = in
    =VLOOKUP(A1,Sheet2!A1:B127,2,FALSE)="Bill"
    so for 1.
    to reference other sheets you need to make it a named formula
    tools/insert/name/define pick a name say baron (in 2007 its formulas tab/defined names)
    put that in the names in workbook field
    in the "refers to" put
    =VLOOKUP(Sheet1!$A$1,Sheet2!$A$1:$B$127,2,FALSE)="Bill"
    click ok
    now in your cf use
    =baron
    Last edited by martindwilson; 07-26-2010 at 06:00 AM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    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

  3. #3
    Registered User
    Join Date
    03-13-2010
    Location
    Birmingham, England
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Conditional formatting using VLOOKUP

    Martin - thanks for your help. Just to clarify, A1 is the cell I want to look up but this will need to fill down (you've specified this as $A$!1) - can I have the cell reference change so I can use the function throughout the worksheet?

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

    Re: Conditional formatting using VLOOKUP

    change the names formula to=VLOOKUP(Sheet1!A1,Sheet2!$A$1:$B$127,2,FALSE)="Bill"

+ 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