Learn how to use conditional formatting in Google Sheets. This guide covers everything from setting basic formatting rules based on numbers, text, dates, and other cell values, to using custom formulas for cases like deadlines or specific values. By setting up format rules tailored to your unique needs, you’ll save time, reduce errors, and make the most important details stand out.
What is Google Sheets conditional formatting?
Highlighting specific data with color is a great way to emphasize key information — many of us do this all the time.
But if you have data that changes frequently, like values that rise or fall above a certain number, or cells containing particular keywords, manually formatting each cell can be time-consuming and prone to errors.
Wouldn't it be great if such changes to formatting occurred automatically?
Conditional formatting in Google Sheets does just that. It automatically updates cell colors based on rules you set so that important cells stand out immediately.
Let’s explore some examples so you see how easily Google Sheets can apply and adjust formats based on data in real-time.
How to add a conditional formatting rule
Whatever conditional formatting rule you'd like to add in Google Sheets, it all starts the same — with a few clicks:
- Select the cells you want to apply the rule to.
- Go to Format > Conditional formatting in the Google Sheets menu:
- A panel will appear on the right side of the screen where you’ll set the details of the rule:
- edit the range to apply the rule to if needed
- set up the condition that best fits your needs
- choose how you want the cells to look like when the rule is met: set a background color or/and font color; make the text bold, italic, underlined or strikethrough.
- Once everything's set, click Done to save the rule.
You can add more rules by clicking Add another rule on the same pane. And you can easily modify or remove existing rules anytime:
With this general setup, you’re ready to create specific formatting rules for various use cases. Let’s jump right in ?
Set up simple formatting rule for numbers
Conditional formatting in Google Sheets is a fantastic way to visually highlight numerical data based on specific values. So let's suppose you want to color orders greater than $200 in total sales (column F):
- Select column F (a column with your numbers).
- Go to Format > Conditional formatting.
- Choose a condition from the dropdown menu: Greater than or equal to, and enter 200 in the provided field:
- Set the formatting style you prefer. For instance, use bold red text on a yellow fill color to make the cells stand out:
The style will be immediately applied to all cells meeting your condition: they all change colors accordingly.
As an alternative, for a more nuanced visualization, you can use a color scale:
- In the Conditional format rules sidebar, switch to the Color scale tab.
- Pick one of the existing sets of colors.
- Or customize colors for the minimum, maximum and (optionally) midpoint values. For example, set light green for the smallest numbers and dark green for the largest so that cells gradually darken as values increase:
These are simple yet effective ways to draw attention to numerical patterns in your data ?
Format cells in Google Sheets by multiple conditions
In some cases, you may want to apply different formats based on different conditions to the cells in the same column. Let's say you need to color orders over $200 in green and orders under $100 in red to draw attention to these specific amounts.
If color scale is not your best bet, you can try creating several formatting rules, each specific to one criterion:
- Greater than or equal to 200.
- Less than or equal to 100.
All your rules will be applied at the same time. Thus, multiple rules let you create a more tailored view of your data, spot key patterns and take action accordingly.
Google Sheets conditional formatting with custom formulas
While Google Sheets offers standard options to format cells, they may sometimes fall short of covering specific or complex cases where a custom approach is needed. That’s why there's this option to use custom formulas as conditions.
Custom formulas let you build your own rules using standard functions and operators. You'll be able to specify whether a cell meets a particular condition. The result of the formula should be either TRUE or FALSE — if TRUE, the formatting will be applied.
To get started, choose Custom formula is from the drop-down menu in the Conditional format sidebar:
Let me cover some useful examples so you see how this can work, from highlighting the highest values to marking minimum values while excluding zeros.
Custom formula to highlight max value
To color only the max number in a range, use this custom formula in conditional formatting in Google Sheets:
=F2=MAX($F$2:$F$50)
It checks if each cell in the range is equal to the maximum value and applies formatting accordingly:
Color top N values
If you want to color the top three (or other N) values in a range, create as many formatting rules as you need values, with the following custom formulas for each position:
=F2=LARGE($F$2:$F$50, 2)
you will need to replace 1 with 2, 3, etc. for each next value you'd like to color:
Highlight the lowest value
To highlight the lowest number in a range, use the MIN function in your custom formula:
=F2=MIN($F$2:$F$50)
Exclude zeros for minimum value
If you prefer don't count on zeros as lowest values, use MIN along with FILTER to exclude zeros and color the actual minimum value:
=F2=MIN(FILTER($F$2:$F$50, $F$2:$F$50>0))
Color bottom N values
For cases where you need to highlight N lowest numbers, use the SMALL function indicating the position of the number (1st or 2nd small, etc):
=F2=SMALL($F$2:$F$50, 1)
As you can see, custom formulas add flexibility to conditional formatting in Google Sheets. I’ll return to them often throughout this article to solve other specific formatting cases!
Conditional formatting if cell contains text
To conditionally format cells with text in Google Sheets, use the related rule: Text contains
In addition to just entering the word itself, you can incorporate wildcard characters to enable broader pattern matching for the search:
- Asterisk (*) matches any number of characters. Thus, d* pattern will find dark chocolates.
- Question mark (?) matches exactly one character. Thus, d??? pattern will find dark chocolates.
Tip. To find the actual asterisks and question marks in your cells, add a tilde (~) right before them. For example, Dark~? will look for cell that actualy contain string Dark?
Custom formulas with REGEXMATCH will also be a good fit here for highly specific searches:
=REGEXMATCH(D2:D50,"Dark")
Google Sheets conditional formatting with dates
Managing deadlines or tracking orders is yet another task you can cover with conditional formatting. Google Sheets lets you set up custom rules to highlight dates within specific time frames or to signal when deadlines have passed.
Example 1. Google Sheets conditional formatting if date is within 7 days
Let's highlight those arrival dates that are expected to happen within the next 7 days.
The arrival dates are in column G. If you break down the logic, you will need to check that the date in column G is either today or within the next 7 days. This custom formula will do the trick:
=AND(G2>=TODAY(), G2<=TODAY()+7)
If the starting date is not today though, simply replace TODAY with the DATE function specifying the date of interest:
=AND(G2>=DATE(2024,11,25), G2<=DATE(2024,11,25)+7)
As a result, all dates within the upcoming week from the intended dates will be instantly spotted providing a quick view of the closest order arrivals.
Example 2: Highlight past due dates
Identifying overdue dates is useful for tracking deadlines or incomplete tasks.
To create such a rule, you need a formula that will check for any date that is before the expected end date. Additionally, there may be cells without the actual end dates (blanks) meaning they've never been completed.
Both these criteria fit nicely into one custom formula for your format rule:
=OR(H2>G2,H2="")
Tip. If the end date is not in the table, do the same as in the example above and specify it using the DATE function:
=OR(H2>DATE(2024,10,26),H2="")
How to format blank cells
Highlighting cells based on text or numbers is helpful, but what about blank cells? Formatting based on blanks can be useful for tracking data completion or signaling about cells that still need attention.
If you only need to check whether a cell is blank, simply select Is empty or Is not empty in the conditional formatting rules.
But if you want to combine this with another condition, you'll need a custom formula. Here are 2 basic formulas for your conditional formatting in Google Sheets:
- To format blank cells: =""
- To format non-blank cells: <>""
Let's suppose you have an order status in column G and corresponding details in column H. If the status is Ready to Complete but the details are missing, you want to color that blank cell in column H blue to remind you to fill in the necessary information.
Here's a custom formula for this:
=AND(G2="Ready to Complete",H2="")
This formula checks if the status is Ready to Complete and if column H is empty. When both conditions are met, the formatting will apply.
Use this approach with empty/non-empty cells in other parts of your sheet to highlight missing values or track completion status.
Conditional formatting based on checkboxes in Google Sheets
Checkboxes can help you dynamically change formatting when checked (TRUE) or unchecked (FALSE). This is particularly useful for tracking tasks, to-do lists, and other datasets that rely on a checked/uncheked status.
You'll need custom formulas for this task:
- To format cells where a checkbox is checked, use a formula with TRUE:
=G2=TRUEmake sure to apply it to a column with checkboxes
- To format cells where a checkbox is unchecked, use a formula with FALSE:
=G2=FALSE
How to use Google Sheets conditional formatting to highlight entire row
Conditional formatting in Google Sheets can also format entire rows in your table. Let's see how it works by the example of checkboxes. I'll highlight all related data in a row whenever a checkbox is checked.
- Select the range you want to format. This should be your entire table (except for header) if you want to color the entire row: A2:G50
- In your custom formula, you’ll want to create an absolute reference to the column containing the checkbox (e.g., $G) so the formatting rule always refers to this one column. As for the row, let it remain flexible (2) so the rule is applied to each row individually:
=$G2=TRUE
This automatically formats entire rows whenever the checkbox in column G is checked.
Note. So remember, 3 things are key for formatting an entire row instead of a single cell:
- apply the format to the entire table
- use an absolute reference for the column ($G)
- and a relative reference for the row (2)
Google Sheets conditional formatting based on another cell
Did you know that you can format certain cells based on values in different cells? This lets you easily change the condition itself (in a cell) without updating the conditional formatting rule directly.
Suppose you want to color rows where Qty per order is less than 50 or more than 100:
- Start by entering those values in helper cells (for example, in column I next to your table):
- Open Conditional format rules and set up your whole table (but its header) as a range to format: A2:G50
- Then goes the formula for your first rule — the one that will highlight orders with quantities over 100:
=$E2>=$I$3Note. Use absolute references ($) when referencing cells outside the table: $I$3. They will make sure that whatever you do with the table, the formula will still refer to this cell.
- Add a second rule to color order with fewer than 50 items. Click Add another rule at the bottom and change your custom formula to:
=$E2<=$I$2
This two-rule approach will highlight largest and the smallest orders based on different conditions, allowing quick updates just by changing values in column I.
Conditional formatting based on another sheet
Placing condition cells like I2 and I3 on a separate sheet can help keep the main sheet tidy. However, Google Sheets doesn’t support direct references to other sheets in conditional formatting rules. Named ranges also won't help here. To solve this riddle, use the INDIRECT function to reference cells across sheets.
Here’s how you set up conditional formatting based on another sheet:
- Move your condition cells (with the min and max order Qty.) to another sheet. Let’s say they’re now in Sheet2 in cells C2 and C3:
- In your rule settings, select your original table on Sheet1 as a range to format: A2:G50
- As for the custom formula, use INDIRECT to reference C2 in Sheet2:
=$E2<=INDIRECT("Sheet2!C2")The INDIRECT function will convert your text string "Sheet2!C2" into a cell reference that your formatting rule can read:
- Similarly, for the upper limit, add another rule:
=$E2>=INDIRECT("Sheet2!C3")
With these formulas, you can update conditions on Sheet2, and the conditional formatting on your main sheet will adjust automatically. And no clutter on your main sheet ?
How to remove conditional formatting in Google Sheets
Removing conditional formatting from your table is just as easy as adding it:
- Select any cell within the range where you’ve applied conditional formatting.
- Go to Format > Conditional formatting.
- On the sidebar that appears, you'll see all the rules applied to the range.
- Hover over the rule you want to remove and click the trash icon.
This will delete that specific rule without affecting other rules or formats.
With all these tips in mind, Google Sheets conditional formatting will play a key role in managing your data. From highlighting values, dates, and text patterns to setting up adaptable rules with custom formulas, you will bring clarity to your data. Now you’re ready to bring your data to life in Google Sheets! ?
by
Latest comments
hello, please how can I format a cell which contains a formula?
The cell with a formula is formatted as usual. Could you be more specific, because I feel there should be something more in your question?
I attempted to utilize the formula =IF(LEN(F2)7,"",F2) in the F column subsequent to incorporating =IF(LEN(E2)10,"",E2) in Column E on Google Sheets; however, the F column did not function as expected, displaying the message, "The data you entered in cell F103 violates the data validation rules set on this cell." I would greatly appreciate any assistance with an alternative formula for column F that adheres to the criteria specified in my initial approach.
Hello,
It looks like your formulas are missing comparison operators after the LEN function. For example, an equal sign (=):
=IF(LEN(F2)=7,"",F2)
or greater than (>) depending on your task
=IF(LEN(E2)>10,"",E2)
If this doesn't help, please specify what's exactly in your F2 and E2 cells.
I want the entire row and column to display colour if it contains #NA and does not. I would also prefer the cell to maintain the colour even if I remove the #NA from a particular row or column.
Hello,
There's one function in Google Sheets that targets the #N/A error specifically: ISNA()
You can use it in your conditional formatting rule to find and color all such cells: =ISNA(A1)
To color the entire row or column, please refer to this section of the article.
Also, since conditional formatting directly depends on the condition, it's impossible to keep the color once #N/A is removed. For that, you need to manually search for all #N/A occurrences and color manually so when #N/A is removed, the colors stay. You can try our Advanced Find and Replace add-on for Google Sheets to look for errors and color found cells.
I want multiple columns and rows to change cell colour if it shows #NA and does not show #NA, please what's the conditional format formula on google sheet.
Hello,
There's one function in Google Sheets that targets the #N/A error specifically: ISNA()
You can use it in your conditional formatting rule to find and color all such cells: =ISNA(A1)
I am trying to find a way to identify cells with specific text within their formula, but I can't seem to figure out a way to do that within the the conditional formatting section. I can do it within the "Find & Replace" function, but I don't know how I can create the conditional formatting using that. Is there a way?
Hello Naomi,
Please try solutions from this part of the article.
If you're still having difficulties, please specify what you're trying to find exactly and what your cells contain.
Hello! I am working with data across multiple sheets. I have first and last names on a master list, and if the same names appears on another list I need them to filter off or highlight to avoid duplicates in my data. Do you have a suggestion on how to filter this data. Since the information is dynamic I am not sure how to approach this.
Thank you in advance!
Hello Sydney,
You will find the info on how to compare columns and conditionally format duplicates in this article.
Hello,
Thank you for your explanation.
Could I please get some advice on how to construct the following as a formula: C2 goes green if C3:C13 are all green.
I've tried various ways and none have worked. Thanks for your help!
Hello!
To determine the color of a cell using a formula, use this article's recommendations: How to count cells by color in Google Sheets. You can use the Function by color in conditional formatting. I hope it’ll be helpful.
How to apply conditional formatting in a row if it has a sentence every row and you wanted to color it yellow if one row has this two names in a sentence?
Hello Angelica,
I believe the following parts of the blog post will answer your questions:
Format cells by the text they contain
Apply conditional formatting to entire rows
I have a list of order statuses in Column A - including "Ready to Complete" and "Incomplete" and numerical data in Column L.
I need a conditional formatting formula for:
If the status in Column A is "Ready to Complete" and the cell in Column L is blank than the blank cell turns blue
I've been able to do one or the other, but not both. I tried =$A6 = "Ready to Complete" - but it would trigger for Incomplete and not Ready to complete.
Hello Nicole,
you can combine both conditions using the AND function, like this:
=AND(A2="Ready to Complete",L2="")
how to highlighted the highest value cell in a multi range (A1:N40)?
Tks in advance
Hello Luky,
Create a conditional formatting rule with a custom formula like this (with the MAX function):
=A1=MAX($A$1:$N$40)
Hello,
Column H has numbers, Column I has numbers. I wish to have a formula that tells me if the number in Column I is greater or less Column H. What would I be best to do?
Hello!
If I understand your task correctly, the formula below to solve your task
=if(I1>=H1,"More","Less")
After that, you can copy this formula down along the column.
Is it possible to shade the text of a cell if it's a formula? So if the cell contains a formula, it's output will be blue?
It doesn't need to be a specific formula, just for any cell that contains a formula, change it's color.
Sure,
assuming you want to check and colour cells in A2:A10, apply the conditional formatting to this range with a Custom formula as a rule and a formula like this:
=ISFORMULA(A2:A10)
I got the Answer..
Apply to range: B1:C
Format cells if... Custom Formula is...
Formula: =IF($A1<>"",B1="")
Format:
It may be helpful to someone..
Thank for your comments Rishabh.
Unfortunately, your solution doesn't work correctly.
I'd suggest creating 2 different rules in the following order:
Hi there. Thank you for this great article.
My question is this:
I have two columns, A and B. Column A is my Due date and column B is my Shipped Date. All of column A has already four conditional formatting applied as follows:
Condition 1: Format cells if greater than =today()+7 - background green
Condition 2: Format cells if is between =today()+1 & =today()+6 - background yellow
Condition 3: Format cells if is between =today()+0 & =today()-14 - background orange
Condition 4: Format cells if less than =today()-14 - background red
Now I would like to strikethrough the text in any cell in column if there is a value in the corresponding cell in column B. How do I format that? Please help?
Thank you!
Hi Jon,
Formatting styles let you not only change the background color of cells but also alter the font in different ways. Simply create a new rule (for example, =B1:B10<>""), apply it to A1:A10, and choose Strikethrough in the Formatting style of the rule.
Thank you very much.
Excellent article team.
The variation I am looking for is how do I highlight more than one text item; i.e. if my range includes ANY of "red", "white" or "blue", I want to highlight (at least the cell, maybe the row).
(Would your suggestion be case-insensitive?)
Would your response also work for filtering?
Thank you for the feedback, Colin!
You can create three separate rules for when Text contains: red / white / blue (case-insensitive).
Or use three custom formulas like this to color entire rows (case-sensitive):
=REGEXMATCH($B1:$B10,"white")
In this case, you apply the rule to the entire table but use only the column where words appear in the rule. This case is described here.
The rules work only for visible cells.
Hello there. Is it possible to have 1 rule "handling" the color of the text and 1 rule handling the fill color of the cell?
For example, I have in the range A2:Z300, a rule (=$B2="Something") that determines the fill color of the entire row.
Then I have another rule (=A2="somethingElse"), again in the same range that determines the text color of the cell that contains "somethingElse". To me it seems that the rules are working the same way it works when you have the "stop if true" enabled in excel. Is there a way to disable this?
Ty.
Is it possible to exclude $0 value in colour scale? e.g. e7:p48 contain monthly spends per client, where client has not started spending or does not spend value comes in as zero. I need the colour scale to show lowest monthly spend and highest, excluding zero value - is this possible?
Hi Lara,
the combination of MIN and IF lets you find the lowest value excluding zeros:
=ARRAYFORMULA(MIN(IF($E$7:$P$48<>0,$E$7:$P$48)))
for the highest excluding zero, try this one:
=ARRAYFORMULA(MAX(IF($B$1:$B$9<>0,$B$1:$B$9)))
Hi Natalia!
I need your help!
I below is a small illustration of my table. the 1st row "1 2 3 4" runs till 31 and represents the days of the month. So my objective is to highlight entire column based on the current day of the month, and also highlight the name of the person where their value is "1" on current day of month
1 2 3 4
TOM 1 0 1 0
JACK 0 1 1 0
JILL 0 0 0 0
=$1:$1=DAY(NOW())
This works for highlighting the column based on day of month, but I cant get the formula to high the name base on the value in the current day.
What I have so far:
=INDIRECT(CHAR(DAY(NOW())+64)&":"&CHAR(DAY(NOW())+64))=1
Thank you so much!
Hi Amos,
What if you try the following?
=AND(2:2=1,$1:$1=DAY(NOW()))
This highlights all cells with "1" based on the day of the month (today).
Hi Natalia,
Thank you so much for your reply. I managed to solve it in a different way.
I created an extra column (hidden) with the formula =HLOOKUP(DAY(TODAY()),/*my data range*/,6). Then in my 1st column where I have the names, my custom formula for the conditional formatting was to check and highlight the name if that hidden column contains a '1' in that row. But thanks a lot anyways :)
Hi Amos,
It's good to know you found a solution that works for you!
Thank you for sharing your workaround with us. :)
I've shared a sample sheet as I cannot get it to compare
Just to confirm, I'd like to highlight any entries in column H that apear on sheet IP in column A
Thank you for the file, Daniel.
I wasn't able to make the formula work on your data though it perfectly runs on mine.
However, I've come up with another formula for you to try in conditional formatting:
=AND($H3<>"",MATCH($H3,INDIRECT("IPList!A:A"),0))
Please let me know if it works.
Hi,
I would like to ask 1 question. when doing a conditional formating,
for the format rules, can i use text that contains "a range"
for example, my data range is D2:D50, and i want to highlight cells that has duplicates/ names that are found in range D60:D70.
Is that possible??? have been trying to solve this for 2 days
thank you so much...
Hi Natalie,
Since you have two ranges that you'd like to compare for duplicates and highlight, please read this article.