by Allen Wyatt
(last updated May 1, 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 Excel in Office 365.
Solve Real Business Problems Master business modeling and analysis techniques with Excel and transform data into bottom-line results. This hands-on, scenario-focused guide shows you how to use the latest Excel tools to integrate data from multiple tables. Check out Microsoft Excel 2013 Data Analysis and Business Modeling today!
Setting up conditional formatting can be challenging under some circumstances, but once set it can work great. Unless, of ...Discover More
You may use Excel to track due dates for a variety of purposes. As a due date approaches, you may want that fact drawn to ...Discover More
You can use conditional formatting to add shading to various cells in your worksheet. This tip shows how you can shade ...Discover More
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
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.