+ Reply to Thread
Results 1 to 9 of 9

Comparing two columns of time using Conditional Formatting In Excel

  1. #1
    Registered User
    Join Date
    11-01-2011
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    4

    Comparing two columns of time using Conditional Formatting In Excel

    Hi all,
    I am trying (and failing!!) to apply what should be an easy conditional format to two lists of times, so that if any cell from one column is the same as any cell in the other it should highlight both cells. I have attached a workbook example.
    Thanks in advance.
    K
    Attached Files Attached Files
    Last edited by kar82; 11-02-2011 at 07:11 PM.

  2. #2
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Comparing two columns of time using Conditional Formatting In Excel

    This conditional formula will do it. Use it with the Formula Is option

    Select A3 to the end and enter this formula
    =MATCH(A3,$B$3:$B$146,0)

    Select B3 to the end and enter this formula
    =MATCH(B3,$A$3:$A$146,0)

    But in your data sample, there are no matches.

  3. #3
    Registered User
    Join Date
    11-01-2011
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Comparing two columns of time using Conditional Formatting In Excel

    Thanks for your quick reply, this formatting has worked a treat after I put in some time frames that were the same. If I could ask one more question? Could I highlight in another colour, times from each column that occur within 5 seconds of each other, if Column A occurs first, in one colour and if Column B occurs first in another? Hopefully that makes sense.
    Again thank you so much for the quick advice. Greatly appreciated!!

  4. #4
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Comparing two columns of time using Conditional Formatting In Excel

    Sorry, confused. Please post a sample with the highlights added manually.

  5. #5
    Registered User
    Join Date
    11-01-2011
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Comparing two columns of time using Conditional Formatting In Excel

    Hiya, I am sorry for the confusion, even when I wrote it I was confused. I ahve attached the workbook with some more clarification on what I would want to occur. Thanks again for your time.
    K
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    11-01-2011
    Location
    india
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Comparing two columns of time using Conditional Formatting In Excel

    VBA CODE 1 -:


    Option Explicit

    Const WelcomePage = "Macros"
    Last edited by er.diljeetsingh; 11-02-2011 at 12:44 AM.

  7. #7
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Comparing two columns of time using Conditional Formatting In Excel

    Highlighting the first occurrance of a near match with a different color is difficult. I don't know if it can be done at all.

    The formula to highlight near matches in column A is (starting in A3)
    =SUMPRODUCT(--($B$3:$B$146<=A3+"00:00:05"),--($B$3:$B$146>=A3-"0:00:05"))

    For column B, starting in B3
    =SUMPRODUCT(--($A$3:$A$146<=B3+"00:00:05"),--($A$3:$A$146>=B3-"0:00:05"))

    This evaluation must be performed before the exact match evaluation, otherwise the exact match highlighting will be overwritten.

    By the way, some of the values include milliseconds, so even if they appear to be the same, they are really not. Format with custom format h:mm:ss.00 to see the difference.

    cheers,

  8. #8
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Comparing two columns of time using Conditional Formatting In Excel

    Hi teylyn.

    Amazing job.

    I and many others, we learn many things in this forum from people like you.

    Congratulations.
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  9. #9
    Registered User
    Join Date
    11-01-2011
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Comparing two columns of time using Conditional Formatting In Excel

    Hi teylyn,
    Thanks for the pointer about the milliseconds, I have now formatted correctly and understand what you were saying. I have now added the two conditional formatting formulas prior to the exact evaluation. I have a significant amount of data and will check as I go along, but this has been such an amazing help. Thanks so much for your quick replies, it is greatly appreciated. I will mark this as solved!!!
    K

+ 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