Share via

Conditional Formatting in Excel

Hasel, James 0 Reputation points
2026-02-26T16:46:43.61+00:00

Build a formula in Excel to Highlight days/times in Column B that do not have a matching day/time within a 24 hour period for the same person/ID Number in column A.

In the example below, the last two rows should be highlighted because there are no other times within 24 hours:

User's image

Microsoft 365 and Office | Excel | For business | Windows
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  2. Marcin Policht 82,025 Reputation points MVP Volunteer Moderator
    2026-02-26T17:34:58.4566667+00:00

    Assuming column A contains the Name/ID (e.g., Last Name, First Name (12345678)) and column B contains the Date/Time, apply this Conditional Formatting formula to the range in column B (for example, B2:B1000):

    =COUNTIFS($A:$A,$A2,$B:$B,">="&$B2-1,$B:$B,"<="&$B2+1)=1
    

    Set the format to highlight when the formula returns TRUE.

    This works by counting how many records have the same ID in column A and a date/time within 24 hours (±1 day) of the value in column B. If the count is 1, it means the only match is itself, so there are no other times within 24 hours for that same person/ID, and the cell will be highlighted.


    If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.

    hth

    Marcin

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.