+ Reply to Thread
Results 1 to 17 of 17

Could a Conditional Formatting color RED if there is any overlapped times?

  1. #1
    Registered User
    Join Date
    06-06-2022
    Location
    USA
    MS-Off Ver
    2007
    Posts
    62

    Could a Conditional Formatting color RED if there is any overlapped times?

    Afternoon, I have J and K columns with times
    which are from starting time to end time.
    Example:
    J1 5:10 pm K1 5:20 pm
    J2 6:25 pm K2 6:35 pm
    J3 6:35 pm K3 6:50 pm
    J4 6:40 pm K4 7:10 pm
    J5 5:15 pm K5 5:30 pm
    and so on...
    I like to CF the overlapping
    times that in this case are:
    J4 and K3
    also
    K1 and J5
    The range is from J1 to K500 and goes from am to pm all over.
    In simple words, they are events and no event can possible
    happen at the same time so RED color will let me know
    the mistake made on the times.
    Thanks.

  2. #2
    Forum Expert
    Join Date
    01-05-2013
    Location
    Singapore
    MS-Off Ver
    H&B2016 & H&B2021
    Posts
    3,062

    Re: Could a Conditional Formatting color RED if there is any overlapped times?

    Try this CF formula, if you have Excel 2021 or 365:
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    06-06-2022
    Location
    USA
    MS-Off Ver
    2007
    Posts
    62

    Re: Could a Conditional Formatting color RED if there is any overlapped times?

    Thanks for your answer but I have XL 2007.
    Also I would like the RED CF going on the times that
    are overlapping on the specific cells that they overlap, that is, applied to columns J and K when overlapping is found.

  4. #4
    Registered User
    Join Date
    06-06-2022
    Location
    USA
    MS-Off Ver
    2007
    Posts
    62

    Re: Could a Conditional Formatting color RED if there is any overlapped times?

    Quick explanation of my definition of overlap:
    7:35 am to 8:05 am
    8:05 am to 8:20 am
    is NOT overlap.

    Now this next one IT IS:
    7:35 am to 8:05 am
    8:00 am to 8:20 am
    in the first example the first event ends and then the second starts at the same time which is okay.
    in the second example the first event ends and then the second starts before the ending time of the first, that is overlapping.

  5. #5
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,570

    Re: Could a Conditional Formatting color RED if there is any overlapped times?

    The SUMPRODUCT function works for the 2007 version.
    To conditionally format J1:J5 try: =SUMPRODUCT((K$1:K$5>J1)*(J$1:J$5<J1))>0
    To conditionally format K1:K5 try: =SUMPRODUCT((K$1:K$5>K1)*(J$1:J$5<K1))>0
    (Thank You to josephteh for producing the file)
    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  6. #6
    Registered User
    Join Date
    06-06-2022
    Location
    USA
    MS-Off Ver
    2007
    Posts
    62

    Re: Could a Conditional Formatting color RED if there is any overlapped times?

    Thank you very much! it works perfect for my purposes.
    My apologies for the late reply, just got back to it today,
    BTW today is the D Day, salute to all who battle for USA on 6-6-44,
    since Google Doddle will NOT care to show it.
    Thanks again.

  7. #7
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,570

    Re: Could a Conditional Formatting color RED if there is any overlapped times?

    You're Welcome. Thank You for the feedback and for marking the thread as 'Solved'. I hope that you have a blessed day.

  8. #8
    Registered User
    Join Date
    06-06-2022
    Location
    USA
    MS-Off Ver
    2007
    Posts
    62

    A solved post that is giving issues now

    I know is maybe not okay to post a new post
    related to another one but it will save everyone
    time. I posted on 6-6-23 a few days ago the one called:
    COULD A CONDITIONAL FORMATTING COLOR RED IF THER IS ANY OVELAPPED TIMES?
    Well the problem was solved and I labeled at SOLVED. BOTH CF formulas worked for that specific RANGE.
    The issue now is when I copy and paste to another range it does not work.
    CF Formula was applied from J1 to J5, then the other formula was applied from K1 to K5.
    Now the copy and paste goes from J15 TO J19 and from K15 to K19 but it does not
    give me the same results, in other words, it does not work like in the original RANGE.
    Thanks

  9. #9
    Registered User
    Join Date
    06-06-2022
    Location
    USA
    MS-Off Ver
    2007
    Posts
    62

    Re: A solved post that is giving issues now

    To conditionally format J1:J5 try: =SUMPRODUCT((K$1:K$5>J1)*(J$1:J$5<J1))>0
    To conditionally format K1:K5 try: =SUMPRODUCT((K$1:K$5>K1)*(J$1:J$5<K1))>0
    These above are the formulas that solved it for me.
    When copying and pasting to another range IT DOES NOT WORK.

  10. #10
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,570

    Re: A solved post that is giving issues now

    Rule: =SUMPRODUCT((K$15:K$19>J15)*(J$15:J$19<J15))>0 Applies to: =$J$15:$J$19
    Rule: =SUMPRODUCT((K$15:K$19>K15)*(J$15:J$19<K15))>0 Applies to: =$K$15:$K$19
    Let us know if you have any questions.

  11. #11
    Registered User
    Join Date
    06-06-2022
    Location
    USA
    MS-Off Ver
    2007
    Posts
    62

    Re: A solved post that is giving issues now

    Thank you very much for the answer but probably I did not explain myself
    well, my apologies since I just mention one more range. The substitution of numbers I can do them, but I will have to
    do it every time. There are not only two ranges they are a bunch of them going down my worksheet.
    So, the question will be: Can that range with the two formulas be copied and paste down the worksheet
    several times? I did it but it did not work like the original one, then I removed the $ sign, still DIDNT work.

  12. #12
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,570

    Re: A solved post that is giving issues now

    I'll make a file that illustrates what I feel you are describing, however it would be easier to help if you would show us what your data looks like in an Excel file.
    Note that the rules are still: =SUMPRODUCT((K$1:K$5>J1)*(J$1:J$5<J1))>0 and =SUMPRODUCT((K$1:K$5>K1)*(J$1:J$5<K1))>0
    The applies to for the first rule is: =$J$1:$J$5,$J$15:$J$19
    For the second rule: =$K$1:$K$5,$K$15:$K$19
    For each new range there should be a comma and then the cells that are in that range. (I hope that makes sense)
    Let us know if you have any questions.

  13. #13
    Registered User
    Join Date
    06-06-2022
    Location
    USA
    MS-Off Ver
    2007
    Posts
    62

    Re: A solved post that is giving issues now

    Yes, you file is exactly alike to mine, and your formula is perfect,
    The only issue is that every range (like J1:K5 and J15 : K19) is a day of the week so I will have to add
    363 more ranges separated by the coma, and YES it makes sense and I understand it.
    I was thinking XL would have an easier way to do it.
    I'm used to copy and paste formulas in different ranges and use $ or not
    as needed for relative or absolute results but not in CF, I guess it is different.

  14. #14
    Registered User
    Join Date
    06-06-2022
    Location
    USA
    MS-Off Ver
    2007
    Posts
    62

    Re: A solved post that is giving issues now

    Sorry, meant "a day of the year"

  15. #15
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,980

    Re: Could a Conditional Formatting color RED if there is any overlapped times?

    Please don't open multiple threads on the same issue. Your new thread's title was very poor, also.

    I have merged the two threads and removed the SOLVED tag. Continue here, please.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  16. #16
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,570

    Re: Could a Conditional Formatting color RED if there is any overlapped times?

    This might be a work around:
    1. Put the dates in cell I1 and I15
    2. Populate M1:N19 using: =IF(J1="","",SUM(LOOKUP(2,1/($I$1:$I1<>""),$I$1:$I1),J1))
    3. Rule for column M: =SUMPRODUCT((N$1:N$19>M1)*(M$1:M$19<M1))>0 Applies to: =$M$1:$M$19
    4. Rule for column N: =SUMPRODUCT((N$1:N$19>N1)*(M$1:M$19<N1))>0 Applies to: =$N$1:$N$19
    Note that the range in the rule and in the applies to may be changed to include the last row of the actual data.
    Let us know if you have any questions.

  17. #17
    Registered User
    Join Date
    06-06-2022
    Location
    USA
    MS-Off Ver
    2007
    Posts
    62

    Re: Could a Conditional Formatting color RED if there is any overlapped times?

    I had to do some adjustment to my worksheet and some changes since I have populated already those rows you used but it will
    work for me, Thanks, you are a heck of a moderator instead
    of worrying about double posting or other inconsequential issues you
    really worked yourself on this one. I never lost hope
    and I really appreciate it. Today, we in the USA are proud of you.
    Thanks again.

+ 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. Match cell color to range that uses conditional formatting color scales
    By pc2011 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-31-2022, 09:37 AM
  2. [SOLVED] How to get interior.color to use conditional formatting color?
    By tahi.laci in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-28-2015, 12:34 PM
  3. [SOLVED] Conditional Formatting like Color Scale but doing it via Interior.Color
    By Hyflex in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-04-2015, 06:36 AM
  4. Replies: 3
    Last Post: 05-30-2014, 10:24 AM
  5. [SOLVED] Conditional formatting to adapt font color to background color
    By jankee in forum Excel General
    Replies: 4
    Last Post: 08-23-2013, 09:38 AM
  6. [SOLVED] Conditional color formatting entries have wild color.
    By John Geyer in forum Excel General
    Replies: 0
    Last Post: 02-24-2006, 02:15 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