Day 20: Advanced Conditional Formatting with Formulas

Day 20: Advanced Conditional Formatting with Formulas

Welcome to Day 20 of your 50-day Excel learning journey! Yesterday, we explored PivotCharts and learned how to create dynamic visualizations. Today, we’ll return to conditional formatting, but this time, we’ll take it to the next level by using formulas to apply complex and customized formatting rules.

Conditional formatting with formulas allows you to highlight data based on dynamic, multi-criteria rules. This makes your spreadsheets even more powerful and insightful. Let’s get started!


Why Use Formulas for Conditional Formatting?

While basic conditional formatting covers common use cases (e.g., highlight cells greater than 100), formulas let you:

  • Create multi-condition rules.
  • Format cells based on values in other columns.
  • Apply dynamic rules that update automatically with data changes.

How to Use Formulas for Conditional Formatting

1. Set Up Your Data

Ensure your dataset is well-organized. Here’s an example dataset we’ll use:

Task Deadline Priority Status
Submit Report 2025-01-15 High Pending
Review Draft 2025-01-20 Medium Completed
Finalize Slides 2025-01-25 Low Pending

2. Apply Conditional Formatting with a Formula

Follow these steps to apply a formula-based rule:

  1. Select the range of cells where you want the formatting applied.
  2. Go to Home > Conditional Formatting > New Rule.
  3. Select Use a Formula to Determine Which Cells to Format.
  4. Enter your formula.
  5. Choose a format (e.g., fill color, font color) and click OK.

Examples of Advanced Conditional Formatting

1. Highlight Overdue Tasks

Highlight tasks where the deadline has passed and the status is "Pending."

Formula:
=AND($B2<TODAY(), $D2="Pending")

Steps:

  • Select the range (e.g., A2:D4).
  • Apply the formula and set a red fill color.

Result: Rows with overdue tasks are highlighted in red.


2. Highlight High-Priority Tasks

Highlight tasks with "High" priority in the Priority column.

Formula:
=$C2="High"

Steps:

  • Select the range (e.g., A2:D4).
  • Apply the formula and choose a bold font with a yellow fill.

Result: High-priority tasks are highlighted for better visibility.


3. Highlight Rows Based on Status

Highlight the entire row for tasks that are "Completed."

Formula:
=$D2="Completed"

Steps:

  • Select the range (e.g., A2:D4).
  • Apply the formula and choose a green fill color.

Result: Rows with "Completed" tasks are shaded green.


4. Compare Two Columns

Highlight rows where the progress is less than 50% of the target.

Example Dataset:

Task Target Progress
Submit Report 100 40
Review Draft 200 150

Formula:
=$C2<($B2*0.5)

Steps:

  • Select the range (e.g., A2:C3).
  • Apply the formula and choose an orange fill.

Result: Rows where progress is less than 50% of the target are highlighted.


5. Highlight Duplicates in a Column

Highlight duplicate values in the "Task" column.

Formula:
=COUNTIF($A$2:$A$10, $A2)>1

Steps:

  • Select the column (e.g., A2:A10).
  • Apply the formula and choose a red fill.

Result: Duplicate tasks are highlighted.


Practical Exercise

Using the initial dataset, practice the following:

  1. Highlight tasks where the deadline is in the past AND the status is "Pending."
  2. Highlight rows for "Completed" tasks in green.
  3. Highlight high-priority tasks in yellow with bold text.

Pro Tips for Conditional Formatting with Formulas

  • Lock References Wisely: Use $ to lock column or row references in your formula as needed (e.g., $B2 for a locked column).
  • Test Your Formula: Use the formula in a blank cell first to ensure it evaluates correctly (TRUE or FALSE).
  • Use Named Ranges: Simplify formulas by using named ranges instead of absolute references.

Common Mistakes to Avoid

  • Incorrect Range Selection: Ensure the range matches your formula logic (e.g., selecting rows when highlighting entire rows).
  • Overlapping Rules: Overlapping formatting rules can make your sheet confusing. Use distinct colors for clarity.
  • Hardcoding Dates: Use dynamic formulas like =TODAY() instead of typing fixed dates.

What’s Next?

Great job mastering advanced conditional formatting! Tomorrow, on Day 21, we’ll explore using slicers for interactive data filtering, a feature that pairs perfectly with PivotTables and dashboards.


SEO Keywords:

  • Advanced conditional formatting in Excel
  • How to use formulas in conditional formatting
  • Conditional formatting examples for rows
  • Highlight overdue tasks in Excel
  • Excel tutorial for advanced formatting rules