+ Reply to Thread
Results 1 to 6 of 6

Conditional format multiple dates in multiple ranges

  1. #1
    Registered User
    Join Date
    12-22-2020
    Location
    Alverstoke, England
    MS-Off Ver
    365
    Posts
    25

    Conditional format multiple dates in multiple ranges

    Hi
    Is there a way to achieve the attached.
    I have multiple ranges of dates and sometimes dates match in the ranges, other times they don't, but I'd like to highlight any dates that match, with a different colour per date
    I hope that makes sense and please do ask if not.

    Thank you in advance
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,361

    Re: Conditional format multiple dates in multiple ranges

    See the attached which uses VBA

    Please Login or Register  to view this content.
    Formula in C2 (C1 is set to 2 to avoid colour index of 2 which is white)

    =IF(AND(COUNTIF($B$2:$B$33,B2)>1,COUNTIF($B$2:$B2,$B2)=1),MAX($C$1:C1)+1,IFERROR(INDEX($C$1:$C1,MATCH($B2,$B$2:$B$33,0)+1),""))

    The first part finds the FIRST occurence of a duplicate date and it is flagged with a number.

    The second part finds the corresponding number when we find the matching date(s) and allocates the corresponding number.

    The VBA code then fills in colour for matching dates.

    Click on button to run macro

    Column B (with the dates) is a named range called "Date_List"

    NOTE: there is a limit of 56 colour codes.
    Attached Files Attached Files
    Last edited by JohnTopley; 03-28-2021 at 12:04 PM.

  3. #3
    Registered User
    Join Date
    12-22-2020
    Location
    Alverstoke, England
    MS-Off Ver
    365
    Posts
    25

    Re: Conditional format multiple dates in multiple ranges

    Thank you John, I'll try it now.
    You post on a thread that goes round the world and get you answer from someone down the road! Small world.
    I'll let you know how I get on

  4. #4
    Registered User
    Join Date
    12-22-2020
    Location
    Alverstoke, England
    MS-Off Ver
    365
    Posts
    25

    Re: Conditional format multiple dates in multiple ranges

    Morning John,
    This is great and I feel I should've been clearer with my request...I've attached an example exactly what my sheet looks like. It could have up to 30 section in total.
    Is it possible to use the code with this style layout?
    Thank you
    Attached Files Attached Files

  5. #5
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,361

    Re: Conditional format multiple dates in multiple ranges

    See attached

    NOTE: you are limited to 56 colours so having more than 56 date diffrences (actually 54 as I avoided using Black) will cause a problem. I currently have not allowed for this.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    12-22-2020
    Location
    Alverstoke, England
    MS-Off Ver
    365
    Posts
    25

    Re: Conditional format multiple dates in multiple ranges

    Thank you very much. I really appreciate it.

+ 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: 1
    Last Post: 03-25-2020, 04:00 PM
  2. CountIfs multiple dates in multiple ranges
    By catami in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-24-2019, 10:45 AM
  3. [SOLVED] VBA to output column of dates within a range, for multiple ranges
    By Dredpool in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-21-2014, 05:03 PM
  4. [SOLVED] VBA Format Multiple Ranges & LastRow
    By hobbiton73 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-25-2013, 07:45 AM
  5. [SOLVED] VBA Format Multiple Ranges
    By hobbiton73 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-22-2013, 05:18 AM
  6. Conditional Copy of Multiple Ranges
    By astefanacci in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-09-2010, 05:21 PM
  7. Conditional formatting in multiple ranges.
    By SimonH.UK in forum Excel General
    Replies: 6
    Last Post: 11-22-2009, 10:26 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