+ Reply to Thread
Results 1 to 10 of 10

How to conditional format cells based on vlookup/match formula

  1. #1
    Registered User
    Join Date
    07-20-2013
    Location
    Tacoma, Washington
    MS-Off Ver
    Excel 2010
    Posts
    3

    How to conditional format cells based on vlookup/match formula

    I have a vlookup formula which looks at a table and returns the value of a cell which cross-matches the value in the row and specific column (Not sure I am explaining this correctly). Let me see if I can be more clear. I have test questions which only apply for certain workout types. My formula looks at the workout type (column B) and matches the question ID (Row 4) to the table on sheet 2. Where these intersect, the cell is either blank or contains a "x". I would like to replace the formula with conditional formatting to gray the cell out if where the workout status and question ID intersects is blank.

    I have attached a spreadsheet. The top table on Sheet1 contains the results of the vlookup formula. The bottom table on Sheet1 shows how the conditional formatting would look. I need to use conditional formatting because if the question applies to the workout status, the tester will need to input into the cell. If the workout status does not apply, they do not need to answer the question. I need this to be visible so the tester does not waste time answering questions which do not apply.

    The table for the vlookup formula is on Sheet2 of the workbook

    Please let me know if any additional clarification is needed. AND a big thanks of appreciation for the help/support.
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    07-02-2013
    Location
    Stockholm, Sweden
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    197

    Re: How to conditional format cells based on vlookup/match formula

    Mark the range C15:K21
    Use CF formula: =C5=0
    Set the Format as grey filling - OK
    Last edited by Rambo4711; 07-21-2013 at 03:46 AM.

  3. #3
    Forum Contributor ABSTRAKTUS's Avatar
    Join Date
    04-18-2010
    Location
    England
    MS-Off Ver
    Win10 Excel 2016
    Posts
    609

    Re: How to conditional format cells based on vlookup/match formula

    Here you go. See attached. Any good?
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    07-20-2013
    Location
    Tacoma, Washington
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: How to conditional format cells based on vlookup/match formula

    I am sorry, I must not have made my need clear. I want to use the formula in the table on the top to produce the result on the bottom. The source data is on Sheet2. So, C5=0, although will work with the formula in the cell, does not meet my needs. I am needing to eliminate the formula in the cell and just have the cell gray out if the cross-referenced cell in Sheet2 is blank. I built the formula so I could try to understand the values returned. Seeing that the formula returns a "zero" for blanks, I am trying to incorporate that into a conditional formatting formula.

  5. #5
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: How to conditional format cells based on vlookup/match formula

    I couldn't get conditional formatting to take the values directly from Sheet2. Hide the rows that you have with the X and 0 values and the conditional formatting applied to the range below is derived from the values in the original range with the X and 0 values.

    There might be a better way of doing this but right now, the brain isn't working
    Attached Files Attached Files
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  6. #6
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: How to conditional format cells based on vlookup/match formula

    I finally got it to work. The formula in the conditional formatting is:

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    07-20-2013
    Location
    Tacoma, Washington
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: How to conditional format cells based on vlookup/match formula

    Thanks for helping with this. This does give me the desired effect. As the questions (Sheet 2 Headers) and Workout Statuses (Sheet, list in column A) could change in time, this was what was leading me down the path to use vlookup and Match formula. That way, if I am thinking correctly, if the questions or workout statuses change, I will not need to update the conditional formatting. It will work as long as the questions and workout statuses are the same on Sheet 1 and Sheet 2.

    For example. I deleted question BANACOL6 from sheet 2. The conditional formatting was showing the results for BANACOL7 on Sheet 1 for Question BANACOL6. When I deleted BANACOL6 column from sheet 2, the conditional formatting appears to be one column off.

    Is there a way to turn this formula: =(VLOOKUP(B5,banacol,MATCH($C$4,banacol[#Headers],0))) into a yes/no statement where a result of not equal to "X" gets the formatting? Basically, the formula is saying look up the workout status in cell B5 in the table on Sheet 2 (banacol) and Match the question ID. Where these two intersect, return the value. That is why the chart is showing X if there is an X and a 0 if the cell is blank.

    Any other ideas is greatly appreciated.

  8. #8
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: How to conditional format cells based on vlookup/match formula

    I checked the second file that I sent to you. If you delete a column from Sheet2, delete the same column in sheet1 click on C5 and check that under Conditional Formatting that the "Applies to" hasn't changed to something other than the range that you want to be conditionally formatted.

    I tested this a couple of times and the "Applies to" seems to change on its own. Changing it to be the range that you have after the deletion of the columns returned correct results.

    The first sample that I sent to you, worked very much the same way.

    The formula:

    Formula: copy to clipboard
    Please Login or Register  to view this content.

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

    Re: How to conditional format cells based on vlookup/match formula

    careful this is not backwards compatible pre 2010
    "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

  10. #10
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: How to conditional format cells based on vlookup/match formula

    I think there isn't a problem as the profile indicates version 2010 and the formula was supplied by the asker. You are correct though if someone else were to try it with an older version...its a good point.

+ 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. [SOLVED] Conditional formatting based on VLOOKUP/INDEX:MATCH
    By strud in forum Excel General
    Replies: 2
    Last Post: 06-13-2013, 07:02 AM
  2. [SOLVED] conditional format cell based on a match to a range of names
    By fablhof in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 12-01-2012, 12:17 AM
  3. [SOLVED] Conditional formatting based on VLOOKUP & HLOOKUP or MATCH
    By Joss.Terrell in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-27-2012, 11:43 PM
  4. [SOLVED] conditional format based whether VLOOKUP finds a value
    By merlyn45 in forum Excel General
    Replies: 3
    Last Post: 05-14-2012, 02:42 PM
  5. Conditional format formula based on two cells
    By sandernoteborn in forum Excel General
    Replies: 8
    Last Post: 04-09-2009, 05:40 AM

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