|
Home > Format > Conditional > Examples Excel Conditional Formatting Examples
|

Question: In conditional formatting rules, do you need to use the Excel IF function to compare cells to other cells?
Answer: No, you do NOT need to use IF formulas in the Conditional Formatting rules.
In the Conditional Formatting, above the formula box, you'll see this label:
In the formula box, enter a formula to test something, like the Highlight Expired Dates example, shown below. It checks if a date is less than today's date:

The conditional formatting is only applied to the cells where that test result is TRUE.

The following examples use conditional formatting formulas to highlight dates in a list.
1 -- Highlight Upcoming Expiry Dates
4 -- Separate Dates With Top Border Lines
You can use Excel conditional formatting to highlight payments that are due in the next thirty days.
In this example, Due dates are entered in column A.

To set up the conditional formatting for upcoming expiry dates, follow these steps
If you use Excel to keep track of licences, or other things with an expiry date, how do you notice which ones are expiring soon?
To make them stand out, use conditional formatting, and highlight the entire table row, for any expiry dates that are within 30 days of the current date.


You can use Excel conditional formatting to highlight policies with dates that have expired. In this example, due dates are entered in cells B2:B7.

To set up the conditional formatting for past expiry dates, follow these steps
To highlight the weekend dates in a list, you can use conditional formatting. The WEEKDAY function returns a number for each day of the week, so you could adjust this formula to highlight other days of the week.
You can see the steps in this video, and there are written steps below the video
In this example, the Excel file has a list of product sales for the first half of July. We’d like to highlight the dates and sales numbers that fall on a weekend.
Conditional formatting will colour the cells in columns A, B and C light green, for rows with a weekend date (Saturday or Sunday).

To set up the conditional formatting for weekend dates, follow these steps
The weekend rows are highlighted in light green fill colour

If you’re working with a list of tasks or orders, sorted by date, use conditional formatting to separate the dates with a border line.
This makes it easy to see where each date starts, in a long list.

You can see the formatting steps in this video.
The following examples show how to highlight cells based on their content.
1 -- Colour Cells Based on 2 Conditions
2 -- Highlight Cells With Formulas
3 -- Highlight Items in a List
4 -- Cross Off Completed Items
Use Excel conditional formatting to colour cells if 2 conditions are met. In this example, a country code is entered in cell B2. If the code "US" is entered, cells that contain "United States" are coloured red.

You could enter the conditions in the conditional formatting formula, but if you enter them in worksheet cells it's easier to see the conditions, and change them, if necessary.
In this example, the conditions are on the same sheet as the data entry cells, but you can store them on a different sheet. You could also name the cells, and use those names in the conditional formatting formula
To set up the conditions:

Next, set up the cell where a country code can be entered:

Next, add conditional formatting to country cells in the data range. The formula is explained below.

If US is entered in cell B2, and a cell in D5:D14 contains "United States", it is coloured red.

The conditional formatting formula is: =AND($B$2=$E$2,D5=$F$2)
The AND function checks the 2 conditions:
Some notes about the cell references in the formula:
Use Excel conditional formatting to highlight cells that contain a formula. In this example, there are values in cells A2:B8, and totals in cells C2:C8 and in A9:C9

Use Excel conditional formatting to highlight cells that contain values from a different list on the worksheet, such as a criteria list with valid two-digit codes..
In this screen shot, a list in column C has 3 code: AA, BB and CC. In column A, cells with those codes are changed to green color, thanks to a conditional formatting rule.

If you have a list of the tasks that you have to work on, use conditional formatting to cross off completed items. In this example, completed tasks are marked with an X in the "Done" column.
There is a conditional formatting on the list, to cross off completed items, and change the font to light grey. That makes it easier to focus on the tasks that still need to be finished.

To set up this conditional formatting, follow these steps:

After you set up the conditional formatting rule, the item will be crossed off, if you type anything in the "Done" column.
This example is on the Strikethrough sheet in sample file #1.
1 -- Conditional Formatting Examples: Download the sample Excel Conditional Formatting file , with most of the examples from this page. The zipped Excel file is in xlsx format, and does not contain any macros.
2) Expiry Date: This sample file highlights expiry dates that are in 30 days or less. Summary sheet shows total item count, and count of items expiring soon. The zipped Excel file is in xlsx format, and does not contain any macros.
2 --Hidden Data Warning: This sample file shows warnings, if rows or columns are hidden. Formula checks for hidden rows, and conditional formatting marks hidden column. Zipped file does not contain any macros.
3 -- Conditional Formatting for Weather Data: This sample file uses color scale for temperatures, and 4 formula rules for weather conditions - Sun, Cloud, Rain and Snow. The zipped file is in xlsx format, and does not contain macros
4 -- Hidden Questions: Main questions are visible, and conditional formatting hides the follow-up questions. The zipped file is in xlsx format, and does not contain macros
Note: For the Show Selected Color in Cell sample files, go to the Show List and Colors page.
Don't miss my monthly Excel newsletter! You'll get quick tips, article links, and a bit of fun. Add your email, and click Sign Up.
Next, when you get my reply, click the Confirm button. I add this step to protect you from spam!
Color Scales | Icon Sets | Data Bars
Fix Conditional Formatting Extra Rules
Conditional Formatting Multiple Cells
Last updated: August 16, 2025 3:07 PM