Written by Allen Wyatt (last updated May 1, 2021)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, and 2021
Tom has a worksheet that contains start times and end times for jobs. All times are entered in 24-hour notation. He needs a way to highlight any time that is after 17:00 (5:00 pm) or before 08:00 (8:00 am).
This is precisely the situation in which Conditional Formatting really shines. How you put together the formatting rules, though, depends on how your data is set up and what, exactly, you want to highlight.
Let's say that Tom's data is in columns A and B. In column A he enters a start time and in column B he enters the end time. If Tom wants to highlight only those start times that are in the after-hours range, he could follow these steps:
Figure 1. The New Formatting Rule dialog box.
If you wanted to highlight either start or end times that are in the after-hours range, all you have to do is to select both columns A and B in step 2.
When you are specifying your formatting (step 11), I suggest that you don't use a format that fills the interior of the cell with a color. This is because if the cell is blank, it will always meet the test you defined in steps 7-10. (A blank cell would be considered a time of 00:00, which is midnight and therefore after hours.)
If you want a Conditional Format that will check for the blank cells, then you can follow these steps:
The formula in step 7 assumes that the range of cells you selected in step 2 has cell A1 at the upper-left corner of the range. If your range has a different cell in that position, make sure you adjust the formula in step 7 to reflect that difference.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (13853) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and 2021.
Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!
Conditional Formatting is a great boon to effectively displaying the information in your worksheets. If you want to ...
Discover MoreIf you want to highlight cells that contain certain characters, you can use the conditional formatting features of Excel ...
Discover MoreYou can use conditional formatting to add shading to various cells in your worksheet. This tip shows how you can shade ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)
Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2025 Sharon Parq Associates, Inc.
Comments