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=TRUE
make 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$3
Note. 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! 😊
159 comments
I have done a lot of data entry in a column, I want that whatever entry I make, the space should be removed on the auto mode itself, like a mobile number typed (12345 67890) and as soon as you enter, the space should be removed (1234567890) and I have to engage in the same column and row, tell me some formula, Have to remove space only in single anti
I don't want to use control + h
I want to put formula in full column, enter and go away as soon as I die.
Hello MD SAFIK,
If I understand your task correctly and you need to remove white spaces from cells, you will find a bunch of options to do that in this article.
YES SIR
PLEASE REMOVE FOURMULA PROVIDE
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!
Is it possible to use conditional formatting to identify if the numbers in 2 cells are different from each other based on only the first 2 digits of the numbers?
Example:
Column A. Column B
492110 488510
334419 334417
I would need for row 1 to be indicated, but not row 2 (only the first 2 digits of the number matter). I'm trying to do this with a custom formula in conditional formatting because the data itself is being brought into the sheet using a query+unique combo.
Thank you!
Hello Chantelle,
Yes, it's possible. Here is the formula:
=LEFT($A1,2)<>LEFT($B1,2)
Not sure if my previous comment went through - can I please get some help on conditional formatting for two conditions. The AND function doesn't seem to make a difference. (I've shared my sheet)
Cindy, thank you, I can see your spreadsheet. I'll look into and try to help as soon as possible.
Cindy, I've just looked into your spreadsheet. The problem is not in the formula but in the zero values returned to the cells. You see, they're returned as text, not as numbers, that's why the formulas in the conditional formatting rules don't work.
For example, your C4 returns 0 from the John Toomey sheet. But on that sheet, you return 0 with this formula: =IFERROR(AVERAGE(E12:E14), "0")
Double quotes are used for text in Google Sheets, hence this 0 is a text. Remove double quotes to return 0 as numbers. Then your conditional formatting rules will be able to compare your numbers with these zeros and color everything correctly:
=AND($B4<=C4,C4>0)
I didn't look at other cells though, but seeing how many zeros are colored green, I'd suggest you to look through all your formulas and remove all double quotes from all zeros.
Hi, I'm looking for a formula for conditional formatting that will colour my cells only if they meet the criteria AND if they are more than 0. I've tried =AND($B4<=C4, C40) but that doesn't make any difference to =$B4<=C4. There are formulas in my cells but the ones that have 0 have no data to reference as yet.
Hi Cindy,
What numbers are there in C4 and C40?
I am creating a Superbowl Squares on google sheet. I am trying to get the conditional formatting color to show up in the squares from the winner cell.
I use this formula in the winner cell for each quarter, this formula is the first winner from the squares:
=IF(OR(O32="",M32="")," ",INDEX($K$10:$T$29, MATCH(MOD(M32,10),$J$10:$J$29,0),MATCH(MOD(O32,10),$K$9:$T$9,0)))
But I want the conditional Formatting squares to change to fill in that square cell in Blue and its not happening as I will have to manually input he blue color in the square is indicate the winner of the 1st quarter of the game.
Hello Robert,
For me to be able to help you, please share an editable copy of your spreadsheet with us (support@apps4gs.com) with your data and conditional formatting rule that doesn't work. Please also include an extra sheet showing what you're trying to get. I'll look into it.
Note. We keep that Google account for file sharing only and don't monitor its Inbox. Please do not email there. Once you share the file, just confirm by replying to this comment.
Anyone alive in this thread?? Any can't help me with this situation? ;(
Natalia,
Sorry I didnt see your comments on my end till I refreshed my browser. Yes I send a share file that you asked me to do as I added you on.
Let me know if you have access to my google sheet file.
I've got your file, Robert.
As far as I can see, you use the formula mentioned earlier in Q32:R35 to return the winners' names. Please specify what cells exactly (Q32:R35 or the names in K10:T29) should be filled with blue and under what conditions. You can also include a copy of this sheet showing what you're trying to color and when.
In the first quarter the names in K10:T29 should be filled with Blue same goes for the reverse winner.
In the first quarter the names in K10:T29 should be filled with Orange same goes for the reverse winner.
In the first quarter the names in K10:T29 should be filled with Purple same goes for the reverse winner.
In the first quarter the names in K10:T29 should be filled with Light Yellow same goes for the reverse winner.
Thank you for the details, Robert.
Since I don't have the right to edit your file, I will leave the instructions for your conditional rules here.
The 1st quarter and blue colour:
Apply to range:
J8:T28
The custom formula for the rule:
=OR(ADDRESS(ROW(),COLUMN(),4)=CHAR(64+MATCH(MOD($M$31,10),$A$8:$8,0))&MATCH(MOD($O$31,10),$J$1:$J,0),ADDRESS(ROW(),COLUMN(),4)=CHAR(64+MATCH(MOD($O$31,10),$A$8:$8,0))&MATCH(MOD($M$31,10),$J$1:$J,0))
The 2nd quarter and orange color:
Apply to range:
I7:T28
The custom formula for the rule:
=OR(ADDRESS(ROW(),COLUMN(),4)=CHAR(64+MATCH(MOD($M$32,10),$A$7:$7,0))&MATCH(MOD($O$32,10),$I$1:$I,0),ADDRESS(ROW(),COLUMN(),4)=CHAR(64+MATCH(MOD($O$32,10),$A$7:$7,0))&MATCH(MOD($M$32,10),$I$1:$I,0))
You can see a pattern here.
Each Apply to range takes the row of the required quarter into account.
There are two formulas (for the winner + for the reverse winner) that start with the ADDRESS function.
Both these formulas are nested in OR so both of them are checked at the same time.
The range in the first MATCH in each formula starts with a row of the required quarter.
The range of the second MATCH – with the column of the required quarter.
I believe you'll be able to adapt these for the last two quarters :)
Hi i'm working on a cantt chart to show the task duration
start date is column H
days needed is column I
end date is column J
so when start date column (H) and number of days needed column (I) are inserted
then the end date column (J) will automatically be calculated based on a this formula =IF(NOT(ISBLANK(I7)),H7+I7-1, "")
and when the two dates are provided, the calendar chart on the side will be filled with blue color to make the duration dates visually clear based on conditional formatting :
{
apply to range:
L6:CQ110,CR7:CR15,CT7:CT15,CV7:CV15,CU9:CU15,CS10:CS15,CR17:CV110
Format rules
Custom formula is:
=AND(L$4>=$H6,L$4<=$J6)
formatting style
fille color:blue
}
but if there is no dates inserted yet, the chart area is also filled but instead of certain dates duration, the blue fill is in all row cells.
I tried isblank but since the column J has formula it won't respond
so how can i make the area of chart (L6:CQ110,CR7:CR15,CT7:CT15,CV7:CV15,CU9:CU15,CS10:CS15,CR17:CV110)
be either filled only when the end date column has text in it
or how to prevent it from applying the conditional formatting when the end date column has no text on it
i'm really stuck here
thank you in advance
Hi Nour,
please consider sharing an editable copy of your spreadsheet with us: support@apps4gs.com
Note. We keep that Google account for file sharing only and don't monitor its Inbox. Please do not email there. Once you share the file, just confirm by replying to this comment.
If you have confidential information there, you can replace it with some irrelevant data, just keep the format.
I will look into your task and try to help.
done, i shared it with the provided link
sorry i meant with the provided email above
Thank you for sharing the file, Nour.
Yet I can't reproduce the rows filled with blue only when the date is missing. Can you please double check the rows/formulas (remove the dates and make other necessary adjustments) so I could see the behavior right away?
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.
I don't want to have to get an add-on to be able to do this, but thanks! Any work-arounds would be welcome.
Hi! Super useful article! I am in need of some help with a conditional formatting formula.
I have a set of data, one column shows a submitted on date (dd-month-yyyy format), and another column shows a status. There are 4 statuses, one of which is 'data sent'. I'd like to highlight rows where the status column is set to 'Data Sent' and the date in the Submitted on column is more than a month ago from the current date. Is that possible? I've been trying this, but it's not working. =AND($G2="DATA SENT"),C2=DATE(today(),-1)
Hi Hannah,
Thank you for your feedback.
If you put your formula to any cell, it'll hint on the problem.
Try this formula instead:
=AND($G2="DATA SENT",DATEDIF($C2,TODAY(),"M")>=1)