+ Reply to Thread
Results 1 to 5 of 5

Conditional Formatting based on multiple values in table

  1. #1
    Registered User
    Join Date
    12-01-2012
    Location
    Charleston, SC
    MS-Off Ver
    Excel 2010
    Posts
    23

    Conditional Formatting based on multiple values in table

    I have the following table in Excel 2010:
    A B C
    1 Name ArriveDate DepartDate
    2 Smith 10/1/14 10/8/14
    3 Black 10/22/14 10/29/14
    4 Jones 11/14/14 11/21/14

    I have a separate calendar template ... here is a sample from that template:

    A B C D E F G
    1 SUN MON TUE WED THU FRI SAT
    2 10/19/14 10/20/14 10/21/14 10/22/14 10/23/14 10/24/14 10/25/14

    I would like to apply conditional formatting to the cells in the calendar template so that the background of the cell is highlighted if the date value in that cell falls within the "ArriveDate" and "DepartDate" values of a given row in the table.

    In the above example, the goal would be to highlight cells D2:G2 (ideally, I'd like to give cell D2 a different highlight since it is an exact match for one of the values in "ArriveDate" or "DepartDate").

    I simply don't know how to do this.

    Help is greatly appreciated! Thank you in advance for your replies.
    Last edited by jcox1953; 02-09-2014 at 02:19 PM. Reason: Edited - issue Solved!

  2. #2
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.84 (24041420))
    Posts
    8,795

    Re: Conditional Formatting based on multiple values in table

    you should be able to use a lookup / index match

    so OR( index( arrive date cell, match( calendar date , B:B, 0)) , index( depart date cell, match( calendar date , C:C, 0)) )
    OR even a count()
    that covers an exact match
    then an AND
    ( index( arrive date cell, match( calendar date , B:B, 0)) > arrive date , index( depart date cell, match( calendar date , C:C, 0)) < depart date)

    best if you load a example spreadsheet
    Wayne
    if my assistance has helped, and only if you wish to , there is an "* Add Reputation" on the left hand side - you can add to my reputation here

    If you have a solution to your thread - Please mark your thread solved do the following: >
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Registered User
    Join Date
    12-01-2012
    Location
    Charleston, SC
    MS-Off Ver
    Excel 2010
    Posts
    23

    Re: Conditional Formatting based on multiple values in table

    Quote Originally Posted by etaf View Post
    you should be able to use a lookup / index match

    so OR( index( arrive date cell, match( calendar date , B:B, 0)) , index( depart date cell, match( calendar date , C:C, 0)) )
    OR even a count()
    that covers an exact match
    then an AND
    ( index( arrive date cell, match( calendar date , B:B, 0)) > arrive date , index( depart date cell, match( calendar date , C:C, 0)) < depart date)

    best if you load a example spreadsheet
    Thank you, etaf. From what you posted, I was able to figure out how to do the conditional formatting. I was able to change formatting on an exact match using a MATCH function:

    =MATCH(D2,ArriveDate,0)

    where I had created a named range (named "ArriveDate") for cells b1:b4. I created a separate conditional statement with a different formatting where the cell matched the DepartDate, using a similar approach.


    I was able to format the range between the two dates using an AND function to combine two INDEX-MATCH functions, looking something like this (using cell E2 as the baseline):

    =AND(INDEX(ArriveDate,MATCH(1,(ArriveDate<E2)*(DepartDate>E2),0)),INDEX(DepartDate,MATCH(1,(ArriveDate<E2)*(DepartDate>E2),0)))

    I applied that basic formula to all the cells in the calendar table and it works great.

    Thank you very much for getting me started - that was most appreciated!

  4. #4
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.84 (24041420))
    Posts
    8,795

    Re: Conditional Formatting based on multiple values in table

    your welcome

    if my assistance has helped, and only if you wish to , there is a reputation icon * on the left hand side - you can add to my reputation here
    If you have a solution to your thread - Please mark your thread solved do the following: >
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  5. #5
    Registered User
    Join Date
    12-01-2012
    Location
    Charleston, SC
    MS-Off Ver
    Excel 2010
    Posts
    23

    Re: Conditional Formatting based on multiple values in table

    Done. Like I said, you gave me enough info to figure out what I needed to do. I'm less interested in someone doing it for me and more interested in learning so that I can apply it elsewhere.

    I've already gone back and added additional conditional formatting - will probably post something else on that (in a new thread) because I'm not sure if there is an easier / shorter statement that would have given me the same results.

+ 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. Replies: 4
    Last Post: 01-31-2012, 04:36 AM
  2. Replies: 2
    Last Post: 08-27-2011, 03:05 PM
  3. Conditional formatting based on values in A1:A6
    By kpierce in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-28-2011, 11:44 AM
  4. Replies: 2
    Last Post: 08-26-2010, 07:46 AM
  5. Creating a new Table based on Conditional Formatting in another table
    By JPKenny in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-06-2010, 11:48 PM

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