Google Sheets: Format a Cell Greater Than Another Cell
In this article
Yes, you can do this with a custom formula rule. Select the cells you want to format, open Format > Conditional formatting, choose Custom formula is under "Format cells if," and enter a comparison that points at the other cell, such as =A2>B2. The key is getting the cell references right: relative references (no dollar signs) shift with each row, while absolute references ($B$2) stay locked on one cell. Everything else is just choosing your fill colour and range.
What You'll Need
- A Google account with access to Google Sheets (the web version or the mobile app both work, though the custom formula editor is easier on a computer).
- A spreadsheet with at least two columns or cells you want to compare.
- Edit permission on the file if it was shared with you.
Step-by-Step
- Decide which cells get the colour. Conditional formatting colours the range you select, not the cell you compare against. If you want column A highlighted when it beats column B, you select column A. If you want the whole row highlighted, select the whole row range.
- Select the range. Click the first cell and drag, or click the column letter to grab a whole column. For a row-by-row comparison starting at row 2, select
A2:A100rather thanA1:A100so the formula lines up with your data. - Open the rule editor. Go to Format > Conditional formatting. A sidebar opens on the right (on the mobile app, tap the cell, then the format icon and look for conditional formatting).
- Choose "Custom formula is." In the "Format cells if" dropdown, scroll to the bottom of the list and pick Custom formula is. This is the only option that lets you compare against another cell; the built-in "Greater than" option only accepts a fixed number or text.
- Write the formula using the top-left cell of your range. This trips up almost everyone. The formula is written as if it applies to the first cell of the selection, and Sheets adjusts it for the rest. If your range is
A2:A100and you want A2 highlighted when it is greater than B2, type=A2>B2. Do not start with=A1>B1unless your range starts at row 1. - Use dollar signs only where you need a fixed reference.
=A2>B2compares each row to its own neighbour.=A2>$B$2compares every cell in the range to the single value in B2. Mix them if you want a column locked but the row free, e.g.=A2>B$2. - Pick the formatting. Click the fill colour swatch to choose a background, or use bold text and a text colour. Keep it readable: a light fill with dark text works better than a saturated colour.
- Check the preview and press Done. The sidebar shows a live preview on your selected range. If nothing changes, the formula is probably returning FALSE for every cell, which usually means the reference is off by a row.
- Test with a deliberate change. Type a larger number into one of the compared cells and confirm the highlight appears or disappears as expected. This catches reference errors before you build more rules on top.
Labels in the conditional formatting sidebar can differ slightly between the web version, the Android app and the iPhone app, and Google occasionally renames dropdown entries, so look for the closest match if "Custom formula is" is not worded exactly that way.
Common Mistakes
- Writing the formula for the wrong starting row. A range of
B2:B50needs a formula written for row 2. Writing=B1>C1shifts every comparison up by one row and highlights the wrong cells. - Quoting the formula. Typing
"=A2>B2"with quotation marks turns it into text and the rule never fires. - Forgetting the equals sign. Custom formulas need the leading
=. - Comparing text to numbers. If one column is stored as text (often after a CSV import), the comparison may behave unexpectedly. Check with a quick
=ISNUMBER()test in an empty cell. - Selecting the wrong range. Highlighting column B when you meant to highlight column A is the most common reason a correct formula appears to do nothing.
- Stacking rules in the wrong order. When several rules apply to the same cell, the first matching rule in the list wins unless you reorder them. Drag rules up or down in the sidebar to change priority.
Tips
- Use
>=if "equal to" should also count as a match, and<>for "not equal to." - To highlight an entire row, select
A2:Z100and lock the column in the formula:=$A2>$B2keeps the comparison on column A while the fill spreads across the row. - Add a second rule with the opposite comparison and a different colour to build a simple above/below dashboard.
- Name a cell range (Data > Named ranges) and reference the name in the formula if you compare against a target value that changes often.
- Copy formatting to other sheets by recreating the rule there; conditional formatting rules do not travel with a normal copy-paste of cell contents.
- Keep the number of rules on one range modest. Many overlapping rules make the sheet slow and the logic hard to audit later.
Troubleshooting
Nothing highlights at all. Reopen the rule and confirm the range and the formula's first row match. Then check whether the compared values are really numbers: a leading apostrophe or a text-formatted column will break numeric comparison.
Wrong cells are highlighted. Your formula is offset by a row or column. Delete the rule and rewrite it using the exact top-left cell of the selected range.
The highlight is one row off after sorting or inserting rows. Relative references follow the cells they were written against. If you insert rows above the range, extend the range to include them; if you sort, the rule usually follows the data but re-check the result.
Only the first cell changes colour. This happens when the formula uses absolute references throughout, such as =$A$2>$B$2. Remove the dollar signs from the row number so each row evaluates itself.
The rule works on one sheet but not another. Rules are per-sheet. Recreate the rule on the second sheet, or copy the sheet tab to carry the formatting across.
If that did not work, clear the rule entirely and start fresh with a single cell range and the simplest possible formula, then widen the range once the single cell behaves correctly.
Frequently Asked Questions
Can I compare a cell to a cell on a different sheet?
Yes. Reference it with the sheet name, for example =A2>Sheet2!B2. Wrap the sheet name in single quotes if it contains spaces, like ='Budget 2025'!B2.
Why does the built-in "Greater than" option not work for this?
That option only accepts a fixed value you type in. Comparing against another cell requires "Custom formula is."
Can I highlight a cell when it is greater than a value in the same row but a different column?
Yes, that is the standard use case. Select the cells to colour, then write the formula using relative references so each row compares against its own neighbour, such as =C2>D2.
Does conditional formatting work in the Google Sheets mobile app?
Yes, both the Android and iPhone apps support conditional formatting, including custom formulas, though the editor is more cramped and long formulas are easier to write on a computer.
Will the formatting update automatically when the compared cell changes?
Yes. Conditional formatting recalculates whenever the sheet recalculates, so editing either cell updates the highlight immediately.
Can I apply the same rule to several non-adjacent ranges?
Not in one rule. Add the rule once per range, or select a range that spans both areas if they are contiguous.