Function Problems

How to Conditionally Format Times Between 8:30 AM and 5:30 PM in Excel

Ayan MasoodAyan Masood Nov 10, 2026 869 views

Question details

The user needs to highlight rows in a spreadsheet where a logged call time falls within a specific business hours window (8:30 AM to 5:30 PM).

How to Highlight Cells Between 8:30 AM and 5:30 PM in Excel using Conditional Formatting
Product
Excel
Device & OS
not provided
Scenario
Filtering and visually categorizing call logs based on whether the timestamp falls inside or outside standard operational hours.
Observed behavior
The goal is to automatically apply a background color or text format to rows matching the specific time conditions using a formula rule.
Before you start

Verify that your call timestamps are formatted as real Excel time or date-time values, rather than just text strings, by checking if the values align to the right side of the cell by default.

Solution 1Recommended

Use the AND and TIME Functions in a New Formatting Rule

Create a custom conditional formatting formula to check if the time in a given cell is both greater than or equal to 8:30 AM and less than or equal to 5:30 PM.

Excel handles time as fractional values of a 24-hour day. By using the TIME(hour, minute, second) function, you can reliably establish boundaries for your conditional formatting without worrying about raw decimal conversions.

1
Select your target data range

Highlight the cells or entire rows you wish to format. For example, select A2:D100 if your time data is in column A starting at row 2.

2
Open the Conditional Formatting menu

Navigate to the 'Home' tab on the Excel ribbon, click 'Conditional Formatting', and select 'New Rule'.

3
Choose the formula option

In the dialog box, click on 'Use a formula to determine which cells to format'.

4
Enter the time evaluation formula

In the formula bar, input: =AND($A2>=TIME(8,30,0),$A2<=TIME(17,30,0)). Ensure you adjust '$A2' to match the first cell of your selected time column. The dollar sign locks the column so the entire row gets highlighted.

5
Set your desired format

Click the 'Format' button, choose a background Fill color (like yellow or green), click 'OK', and then 'OK' again to apply the rule.

Use the AND and TIME Functions in a New Formatting Rule
Format Applied: Any times falling strictly within the 8:30 AM and 5:30 PM window, including minute intervals, will now be automatically highlighted.
Easy Spreadsheet Formatting

Highlight Time Ranges Seamlessly with WPS Spreadsheet

WPS Spreadsheet fully supports advanced Excel conditional formatting formulas, including the TIME and AND functions, letting you process complex data logs quickly and accurately.

  1. 1. Open your data file: Launch WPS Spreadsheet and open the document containing your call logs.
  2. 2. Highlight the range: Select the rows or cells that need the time-based highlighting.
  3. 3. Apply the rule: Go to Home > Conditional Formatting > New Rule, choose the formula option, and paste: =AND($A1>=TIME(8,30,0),$A1<=TIME(17,30,0)).
  4. 4. Pick a color: Click 'Format', choose a fill color, and confirm to instantly visualize your target times.
100% compatible with Microsoft Excel conditional formatting rulesSupports complex date and time evaluation functionsCompletely free to use with a familiar, user-friendly ribbon interfaceLightweight software that handles large call logs without lagging
microsoft office alternative - wps office

Frequently Asked Questions

Why is my formula failing if the cell contains both the date and the time?

If a cell contains a full date and time (e.g., '10/25/2023 9:00 AM'), the underlying value is a large number where the fraction represents the time. The standalone TIME function only compares the fraction. To fix this, use the MOD function to extract just the time: =AND(MOD($A1,1)>=TIME(8,30,0), MOD($A1,1)<=TIME(17,30,0)).

How do I format times outside of the 8:30 AM to 5:30 PM window?

To highlight times outside that range, swap the AND function for the OR function and flip the greater/less than operators. Your formula should look like this: =OR($A1<TIME(8,30,0), $A1>TIME(17,30,0)).

How do I ensure the entire row highlights instead of just the cell with the time?

You need to use mixed references in your formula. By placing a dollar sign ($) strictly in front of the column letter (e.g., $A1 instead of A1), you lock the condition to check column A, allowing the formatting rule to spread horizontally across the entire highlighted row.