Smart Systems for Home

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

Google Sheets Conditional Formatting Based on Another Cell

· 6 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

To format a cell based on the value of another cell in Google Sheets, you must use a Custom Formula within the Conditional Formatting menu. Instead of using the standard dropdown presets like "Text contains," you select "Custom formula is" and enter a logical statement (e.g., =$B1="Complete") that tells Google Sheets to apply the formatting if the condition in the referenced cell is true. This allows you to highlight entire rows or specific columns based on a status, a date, or a numerical threshold located elsewhere in your spreadsheet.

What You'll Need

  • A Google account with access to Google Sheets.
  • An existing dataset where one column serves as the "trigger" (the cell being checked) and another area serves as the "target" (the cell being formatted).
  • A basic understanding of cell references (e.g., knowing that A1 refers to the first column and first row).

Step-by-Step

  1. Select the Target Range: Click and drag to highlight the cells or rows that you want to change color. For example, if you want an entire row to turn green when a status in column B is marked "Done," highlight the entire data range (e.g., A2:Z100). Note that labels and menu paths may differ slightly depending on your browser version or region.
  2. Open Conditional Formatting: Go to the top menu and select Format > Conditional formatting. This will open a sidebar panel on the right side of your screen.
  3. Configure the Format Rules: In the sidebar, ensure you are on the "Single color" tab. Under the "Format cells if..." dropdown menu, scroll to the very bottom and select Custom formula is.
  4. Enter the Formula: In the box labeled "Value or formula," type your logical expression. The formula must start with an equals sign (=). For example, if you want to highlight the range based on whether cell B2 says "Urgent," you would enter: =$B2="Urgent".
  5. Understand the Dollar Sign ($): This is the most critical part of the process. The $ symbol creates an absolute reference to the column. By placing it before the B ($B2), you tell Google Sheets: "Always look at column B, regardless of which cell in the row you are currently formatting." If you omit the dollar sign, the formatting will shift horizontally as it moves across your range, and the logic will break.
  6. Set the Formatting Style: Under the "Formatting style" section, choose the fill color, text color, bolding, or italics you want to apply when the condition is met. Click the paint bucket icon to select a background color.
  7. Save the Rule: Click Done at the bottom of the sidebar. Your selected range will now automatically update its appearance whenever the value in the referenced column changes.

Common Mistakes

One of the most frequent errors is forgetting the dollar sign before the column letter. Without the $, Google Sheets uses relative referencing. If your range is A2:C10 and your formula is =B2="Yes", cell A2 looks at B2, but cell B2 looks at C2, and cell C2 looks at D2. This results in a "staggered" or broken highlighting pattern where only some cells in the row change color. Always use =$[Column][Row] to lock the trigger column.

Another common mistake is entering the text value without quotation marks. In Google Sheets formulas, any text string must be enclosed in double quotes. For example, =$B2=Complete will result in an error or fail to trigger because the sheet is looking for a named range called "Complete" rather than the word "Complete." The correct version is =$B2="Complete".

Users also often select the wrong "Apply to range." If your formula references row 2 (=$B2), but your "Apply to range" starts at row 1 (A1:Z100), the formatting will be offset by one row. The row number in your formula must match the first row of your selected range. If your range starts at A5, your formula must reference $B5.

Tips

To handle multiple conditions, you can create multiple rules for the same range. Google Sheets processes these rules in order of priority from top to bottom. If a cell meets the criteria for the first rule, it will apply that color and ignore subsequent rules. You can drag and drop rules in the sidebar to change their priority.

For numerical comparisons, you do not need quotation marks. You can use operators such as > (greater than), < (less than), >= (greater than or equal to), or <> (not equal to). For example, =$C2>100 will highlight the row if the value in column C exceeds 100.

If you need to check if a cell is not empty, use the formula =NOT(ISBLANK($B2)). This is incredibly useful for project trackers where you want a row to change color as soon as any data is entered into a specific column.

You can combine multiple conditions using the AND or OR functions. For instance, if you want a row to turn red only if column B is "Urgent" AND column C is "Overdue," use: =AND($B2="Urgent", $C2="Overdue"). This allows for highly granular data visualization.

Troubleshooting

If the formatting is not appearing, first check for leading or trailing spaces in your data. If a cell contains "Complete " (with a space at the end), the formula ="Complete" will not recognize it as a match. You can fix this by using the TRIM function in your formula: =TRIM($B2)="Complete".

If the wrong cells are being highlighted, double-check the "Apply to range" field in the sidebar. Ensure the starting row of the range matches the row number used in your custom formula. If the range is A2:G100, the formula must be =$B2.... If the range is A1:G100, the formula must be =$B1....

If the colors are not updating in real-time, check if you have overlapping rules. A rule higher up in the list may be overriding the one you just created. Try moving your new rule to the top of the list by hovering over the rule in the sidebar and dragging it upward.

If the formula returns a "Formula is invalid" error, ensure you have started the expression with an equals sign (=) and that all open parentheses ( have a corresponding closing parenthesis ).

Frequently Asked Questions

Can I format a cell based on a cell in a different sheet?

Not directly within the conditional formatting formula box, as it does not support direct cross-sheet references. To achieve this, you must use the INDIRECT function. For example, =INDIRECT("Sheet2!A1")="Yes" will allow the current sheet to react to a value on Sheet2.

Can I use this to highlight an entire row?

Yes. The key is to select the entire data range (e.g., A2:Z100) and use the absolute column reference (the $ sign) in your custom formula. This ensures every cell in the row looks at the same trigger cell in the specified column.

Does this work with checkboxes?

Yes. Checkboxes in Google Sheets are treated as TRUE or FALSE values. To format a cell based on a checkbox in column B, use the formula =$B2=TRUE or simply =$B2, as the value itself is a boolean.

Can I use a formula to highlight cells based on a date?

Yes. You can use functions like TODAY(). For example, to highlight a row if the date in column B is in the past, use =$B2<TODAY(). This is ideal for tracking expired deadlines.

Is there a limit to how many conditional formatting rules I can have?

While there is no hard published limit, having hundreds of complex custom formulas in a single sheet can slow down the performance of your browser and the calculation speed of the spreadsheet.