Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Excel Format Cell Based on Another Cell: How-To

· 7 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Excel can format a cell based on the value in another cell using conditional formatting with a formula rule. The trick is to select the cells you want to format, create a New Rule that uses a formula, and write a formula that points to the other cell with the correct relative or absolute reference. This lets you highlight an entire row when a status column says "Overdue", colour a price when stock is low, or shade a name when a due date has passed.

What You'll Need

  • Excel for Microsoft 365, Excel 2021, 2019, 2016, or Excel for Mac (the conditional formatting formula option is in all of them).
  • A worksheet with at least two columns: one holding the value you want to test (the source cell) and one or more cells you want to format based on it.
  • Basic familiarity with cell references (A1 style) and the difference between relative references like A1 and absolute references like $A1.

Step-by-Step

  1. Decide the source cell and the target range. For example, suppose column D holds a status ("Done", "Pending", "Overdue") and you want to highlight the whole row A2:E100 when D says "Overdue". The source is column D; the target range is A2:E100.
  2. Select the target range first. Click the first cell of the range (A2 in the example), then drag to the last cell (E100), or type the range into the Name Box and press Enter. The active cell must be the top-left cell of the selection, because the formula you write is relative to that cell.
  3. Open Conditional Formatting. On the Home tab, click Conditional Formatting > New Rule. (Menu labels can differ slightly by Excel version and platform; on Mac the path is Home > Conditional Formatting > New Rule.)
  4. Choose "Use a formula to determine which cells to format". This is the option at the bottom of the New Formatting Rule dialog. Do not pick "Format only cells that contain" — that only tests the selected cell itself, not another cell.
  5. Write the formula using the top-left cell of your selection. In the "Format values where this formula is true" box, type a formula that returns TRUE or FALSE. For the example, type =$D2="Overdue". The dollar sign locks the column to D; the row number 2 has no dollar sign so it shifts down row by row. Excel applies the rule to every cell in the range, adjusting the row reference automatically.
  6. Click Format and choose your formatting. Pick a fill colour, font colour, or border on the Fill, Font, or Border tabs, then click OK. Keep the formatting simple — a light fill and bold text is easier to read than a dark fill with dark text.
  7. Preview and confirm. The Preview box shows the formatting, and Excel highlights matching cells in the sheet behind the dialog. Click OK to apply, then OK again to close the Rules Manager if it opened.
  8. Test the rule by changing a source value. Type "Overdue" into D2 and the row should highlight immediately. Change it to "Done" and the highlight should disappear. If it does not, the formula reference is probably wrong — see Troubleshooting.
  9. Add more rules for other values if needed. Repeat steps 3–7 for each condition (for example =$D2="Pending" with a yellow fill). Rules are evaluated in order; use Manage Rules to reorder or set "Stop If True" where one rule should override the others.

Common Mistakes

  • Selecting the wrong active cell. If you select A2:E100 but the active cell is E100, Excel writes the formula relative to E100 and the rule highlights the wrong rows. Always start the selection from the top-left cell.
  • Forgetting the dollar sign on the column. Writing =D2="Overdue" without $D makes the column shift as well as the row, so only the first column of each row is tested and the rest of the row stays unformatted.
  • Testing the wrong cell. A rule applied to A2:E100 that says =$A2="Overdue" checks column A, not column D. Match the formula's column letter to the column that actually holds the value.
  • Quotes around numbers. =$D2="100" compares text, not a number. For numeric tests use =$D2>100 or =$D2=100 without quotes.
  • Case sensitivity confusion. Excel's "=" comparison is not case-sensitive, so "overdue" and "Overdue" both match. If case matters, use the EXACT function inside the formula, for example =EXACT($D2,"Overdue").
  • Applying the rule to a table column instead of the sheet range. Structured table references behave differently; if your data is an Excel Table, select the table range and use normal A1 references in the formula, or apply the rule to the table's data body range.

Tips

  • Use Manage Rules (Conditional Formatting > Manage Rules) to see every rule on the sheet, change the range it applies to, and edit the formula without starting over.
  • To highlight a whole row based on a text match anywhere in a cell, combine with SEARCH: =SEARCH("urgent",$D2) returns a number (treated as TRUE) when found and an error (treated as FALSE) when not.
  • For date-based rules, compare against TODAY(): =$D2<TODAY() highlights past dates. Make sure the source cells are real dates, not text that looks like a date.
  • Keep the number of rules per range small. Many overlapping rules slow large workbooks and make the result hard to predict.
  • If you copy the formatted range to another sheet, the rule moves with it but the formula references may need updating — check Manage Rules afterwards.

Troubleshooting

If nothing highlights, first check the formula itself: click the rule in Manage Rules and look at the formula box. The reference should point to the top-left cell of the applied range. A quick test is to type the same formula into an empty cell on the sheet — it should return TRUE for a row that should be formatted and FALSE for one that should not. If it returns FALSE everywhere, the source value does not match exactly: watch for trailing spaces (use TRIM in the formula, e.g. =TRIM($D2)="Overdue"), numbers stored as text, or a different spelling.

If the wrong cells highlight, the relative/absolute mix is off. Remember: dollar sign before the column letter locks the column; dollar sign before the row number locks the row. For a whole-row rule you almost always want the column locked and the row free.

If the formatting disappears after you edit the sheet, check whether the rule's range was affected — inserting or deleting rows can shift the applied range. Reopen Manage Rules and confirm the "Applies to" box still covers the rows you expect.

If the file was created in an older Excel version or another spreadsheet app, some rule types may not carry over cleanly. Recreate the rule in the current version rather than relying on the imported formatting.

Frequently Asked Questions

Can I format a cell based on text in another cell?

Yes. Use a formula rule such as =$D2="Overdue" and apply it to the range you want formatted. The comparison is not case-sensitive by default.

How do I highlight an entire row based on one cell?

Select the full row range (for example A2:E100), create a formula rule that locks the source column with a dollar sign (=$D2="Overdue"), and apply your fill. The row number stays relative so each row is tested against its own source cell.

Why is my conditional formatting formula not working?

The most common causes are a relative reference where an absolute one is needed, the formula pointing at the wrong column, or the source value not matching exactly because of extra spaces or number-versus-text formatting. Test the formula in a normal cell first.

Can I base formatting on a cell in a different sheet?

Conditional formatting formulas generally cannot reference other worksheets directly in Excel. A practical workaround is to bring the value onto the same sheet with a formula in a helper column, then base the rule on that helper cell.

Does this work in Excel for Mac and Excel Online?

Yes, the New Rule dialog with the formula option is available in Excel for Mac and in Excel for the web, though the exact menu wording can differ slightly by version. The formula syntax is the same.

Can I copy conditional formatting to other cells?

Yes. Copy a cell that has the rule and use Paste Special > Formats, or use the Format Painter. Check Manage Rules afterwards because relative references adjust to the new location.