Excel Conditional Formatting for Errors: A Practical Guide

How-to basics · Updated November 19, 2026

To highlight errors in Excel, select the cells, choose Home > Conditional Formatting > New Rule > Use a formula to determine which cells to format, and enter =ISERROR(A2) if A2 is the top-left cell of your selection. Choose a format and confirm; Excel will then mark cells whose current values are errors, including errors produced by formulas.

What the error check does

Conditional formatting changes how a cell looks when a rule is true; it does not change the cell’s value or repair the formula that caused an error. The ISERROR function checks whether its argument currently evaluates to an Excel error. That makes it useful for drawing attention to problems such as #DIV/0!, #VALUE!, #REF!, #NAME?, and #N/A, as well as other error values Excel may produce.

The rule responds as the worksheet recalculates. If a formula changes from an error to a normal result, the error formatting turns off; if it later returns an error, the format appears again. This differs from manually applying a fill color, which stays until someone changes or clears it. ISERROR also returns FALSE for ordinary text that merely looks like an error, such as the characters #N/A entered as text.

Use this approach when errors are important to notice but should remain visible for investigation. A colored cell can make a broken lookup or invalid calculation easier to find without concealing the underlying result.

Create an error-highlighting rule in Excel

In Excel for Microsoft 365 on Windows, select the cells you want the rule to cover, then follow these steps:

  1. Choose Home > Conditional Formatting > New Rule.
  2. Select Use a formula to determine which cells to format.
  3. Enter the formula that checks the top-left cell of the selected range.
  4. Choose Format, set a fill, font, border, or other available appearance, and select OK.
  5. Confirm the rule. If necessary, open Home > Conditional Formatting > Manage Rules to review the Applies to range.

For example, with cells A2:A100 selected, the rule formula is =ISERROR(A2). Excel evaluates the reference for each cell in the range. When A2 contains an error, the rule is true for A2; when it evaluates the next cell, Excel checks A3, then A4, and so on. The formula must start with an equals sign, just like a worksheet formula.

Pick a format that is noticeable but still readable. A pale red fill with dark text can distinguish errors from ordinary values, while a border or bold font may work better if the sheet already uses colored fills to communicate other information. The format is a visual cue, not a replacement for checking the formula or source data.

How cell references affect the rule

Conditional-formatting formulas use relative and absolute references in the same way as ordinary Excel formulas. The reference should match the top-left cell of the selected Applies to range. Excel adjusts a relative reference as it evaluates other cells. If the range begins at B5, for example, a reference to A2 would check the wrong cell unless that offset is intentional.

When checking each cell in a range, keep the cell reference relative: selecting C2:C500 and checking C2 means Excel checks each cell in that column. For a rectangular range, the same principle applies to its upper-left cell. A common mistake is to select A2:D20 but enter a formula that refers to A1; the rule is then offset by one row and may format the wrong cells.

Absolute references, marked with dollar signs, are useful when every cell should check one fixed location. Mixed references can lock just the column or row. That distinction matters when the goal is to format a whole record based on an error in one designated column.

Highlight a whole row when one cell has an error

To flag complete rows, select the data rows across all columns, then lock the reference to the column to inspect while leaving the row number relative. For a range A2:F100 where the error to check is in column B, select A2:F100 and use this formula:

=ISERROR($B2)

The dollar sign before B keeps the check in column B as Excel applies the rule across columns A through F. The row number is not locked, so the next row checks B3, then B4. Choose a format after entering the formula; every cell across a row receives it when that row’s B cell contains an error. If you instead lock both the column and row, every row would check B2, which is usually not what you want.

Check the Applies to range in Manage Rules if the whole row does not format as expected. The formula and the selected range must be aligned: a rule intended for rows 2 through 100 should use row 2 as its starting reference and should apply to those same rows.

Choose between ISERROR, ISERR, and ISNA

ISERROR is the broad choice when the goal is to flag any Excel error. ISNA is narrower and identifies only #N/A, often used when a missing lookup match is the specific condition that matters. ISERR checks for errors other than #N/A. Select the test that reflects what readers should notice; a rule that checks only #N/A will not highlight #VALUE! or #REF! errors.

For a range A2:A100 where only #N/A should receive formatting, use =ISNA(A2). The cell reference is relative because A2 is the top-left cell of the selected range. This can be preferable in a lookup report where #N/A means no matching record was found, while other errors may deserve a separate warning or a different treatment.

It is also possible to create multiple rules with different formats, such as one for #N/A and another for other errors. Be deliberate about rule order and overlap. In Home > Conditional Formatting > Manage Rules, Excel lets you review rules that apply to the current selection and adjust their order. If multiple rules set the same formatting property, their order and options can affect what appears.

Use error formatting to investigate a worksheet

Error highlighting is especially useful in large sheets where an error could be far from the cell currently being reviewed. It can reveal that an import contains invalid values, that a formula was copied with an incorrect reference, or that a lookup has no matching result. Consider pairing the visual rule with a filter, a summary count, or a review process rather than assuming the color alone explains the cause.

When a cell lights up, inspect the formula bar and the cells it refers to. For example, #DIV/0! often indicates a zero or blank denominator; #REF! can indicate an invalid reference; and #N/A may indicate that a lookup did not find a match. Those examples suggest places to investigate, not universal diagnoses: the cause depends on the particular formula and data.

Sometimes an error is an expected outcome. A lookup may intentionally return #N/A when a record is absent, or a calculation may be incomplete while source data is being entered. In that case, formatting can still help distinguish the condition, but you may want a less urgent color or a rule limited to the relevant area. Avoid coloring every error as a crisis if some represent normal workflow.

Common problems and how to fix them

  • Nothing gets highlighted: Check that the formula starts with an equals sign, refers to the top-left cell of the Applies to range, and tests actual error values rather than text that resembles them.
  • The wrong cells are highlighted: Review the starting row and column in both the formula and Applies to range. Remove an accidental dollar sign if it has locked a reference that should move.
  • Only one cell changes: The Applies to range may include only one cell. Open Manage Rules and expand it to cover the intended cells.
  • The rule seems to stop after new rows are added: Confirm that the new rows are inside the Applies to range. If the data is an Excel table, adding rows within the table may extend formatting, but check the rule rather than assuming it did.
  • A cell looks like an error but is not flagged: It may contain text such as #VALUE! rather than an actual Excel error value. Text and error values are different, even when they look alike on the sheet.

When rules compete, use Manage Rules to inspect their order and settings. A rule that applies a fill can be obscured by another applicable rule that also sets a fill. The Stop If True option can affect rules below it, so use it only when the rule order and intended behavior are clear. If a rule has become confusing, removing it and creating a clean rule for the correct range is often easier than adjusting several overlapping rules.

Formatting errors versus replacing them

Conditional formatting is for visibility. It leaves the error in place, which is useful when someone needs to diagnose or correct the source. IFERROR is a different tool: it returns an alternative result when an expression produces an error. Replacing an error can make a report easier to read, but it can also conceal an issue if the alternative value is treated as a valid result.

Do not use a replacement simply to make a sheet look tidy without deciding what the replacement means. A blank may mean “not available,” while zero may be interpreted as a real measurement. If an error should be fixed, correct the formula or input; if it is an expected exception, document how it should be interpreted. You can also retain the original calculation and use formatting to make unresolved errors visible during review.

Excel for Mac and Excel for the web

In Excel for Mac, select the range and use Home > Conditional Formatting > New Rule, then choose the formula-based rule and set its format. Dialog wording and layout can vary slightly by release, but the essential setup is the same: the formula checks the top-left cell and the rule applies to the chosen range. On a Mac, use the ribbon menus rather than relying on Windows-only keyboard instructions; no keyboard shortcut is needed for this procedure.

Excel for the web also supports conditional formatting, including formula-based rules in current Microsoft 365 versions. Select the range, open Home > Conditional Formatting, and create a rule using a formula if that option is available in the rule panel. The browser interface can differ from the desktop dialog, and some rule-management tasks may be easier in the desktop app. If you cannot find the formula option or need to inspect complex rule order, open the workbook in Excel for Windows or Mac.

Frequently Asked Questions

Can Excel conditional formatting highlight #N/A?

Yes. Use ISERROR to highlight all error values, including #N/A, or use ISNA when you want to highlight only #N/A. In either case, make the formula reference the top-left cell of the selected range.

Does conditional formatting fix the error?

No. It changes the cell’s appearance only. To resolve an error, investigate the formula or source data. If you intentionally want a different displayed result when a formula errors, use an error-handling formula, while making sure the replacement will not be mistaken for valid data.

Can I highlight errors across several columns?

Yes. Select the full rectangular range and use a relative reference to its top-left cell, so Excel checks each cell in turn. For whole-row highlighting based on one column, lock that column and leave the row relative, as in the example above.

Will the rule detect an error typed as text?

No. ISERROR detects an actual Excel error value, not ordinary text that happens to display characters such as #N/A. If imported data stores error-looking strings as text, it requires a text-based rule or data cleanup instead.

Why does the rule highlight the wrong row?

The formula reference may not match the top-left cell of the Applies to range, or a row reference may be locked with a dollar sign. Check both the formula and the range in Manage Rules, then adjust the reference so it moves in the intended direction.

Related

Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.

More in How-to basics

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.