How to Highlight Cells Based on Multiple Conditions in Google Sheets

Published on

    To highlight cells based on multiple conditions, you can use either a custom formula or the built-in rules in Google Sheets. The formula is more flexible, whereas the custom rule is more user-friendly. However, the latter may not be useful in all cases.

    In this tutorial, I’ll show you how to highlight a column:

    • Based on multiple conditions in the same column.
    • Based on multiple conditions in the same column as well as in different columns.

    Highlight a Column Based on Multiple Conditions in the Same Column

    Suppose you want to highlight cells in a single column based on any of the given conditions. You can either use a custom formula or add multiple conditional formatting rules.

    For example, I have the names of a few legendary authors in column A and their works in column B. I want to highlight particular authors. I’ll show you how to perform such conditional formatting with or without a formula.

    Sample Data:

    Sample data: Authors and Book Titles

    I want to highlight the names of two authors, “Agatha Christie” and “Sir Arthur Conan Doyle.” How can I do that?

    As mentioned, there are two methods: using a formula and not using a formula.

    Option 1: Custom Formula

    You can use a custom formula that performs an OR logical test:

    =OR($A1="Agatha Christie", $A1= "Sir Arthur Conan Doyle")

    When you conditional format a column with multiple conditions, keep the following in mind:

    • Write the formula for the first cell in the range.
    • The highlighting area must start from the first cell in the range.
    • Use a smaller range (closed range) and specify the entire column only if necessary. This can improve performance.

    To apply this formula, select the range A1:A15 and click Format > Conditional formatting.

    Under Format cells if, select Custom formula is and enter the above formula in the given field.

    Custom formula for highlighting a single column with multiple conditions

    Select your desired formatting style and click Done.

    This way, you can highlight cells based on multiple conditions in Google Sheets.

    This formula contains two conditions. If you want to add more, place them comma-separated as follows:

    =OR($A1="Agatha Christie", $A1="Sir Arthur Conan Doyle", $A1="Helen Keller")

    Option 2: Using Built-in Rules

    You can achieve conditional formatting with multiple criteria in the same column without using a formula in Google Sheets. In this case, you simply need to apply multiple rules as follows:

    Steps:

    1. Select the range A1:A15.
    2. Go to the Format menu and select Conditional formatting.
    3. Under Format cells if, select Text is exactly and enter “Agatha Christie”.
    4. Click “+ Add another rule” and enter “Sir Arthur Conan Doyle”.
    5. Click Done.
    Single Column Multiple Criteria Highlighting with Built-in Rules

    This is a simple way to highlight cells based on multiple conditions in Google Sheets.

    However, it has a drawback: you cannot match a value in a column and highlight the entire row. This is possible with the formula approach by extending the Apply to range from A1:A15 to A1:Z15.

    In short, the custom formula approach is generally more powerful and versatile, so I suggest you stick with that.

    Highlight a Column Based on Multiple Conditions in Different Columns

    Built-in rules are not suitable for this task, so you must rely on a custom formula.

    For example, in column A, you have author names, in column B, their book titles, and in column C, publication dates. The data is structured with a header row (A1:C1) containing field labels.

    Highlight a Column Based on Multiple Conditions in Different Columns

    To highlight book titles in column B that match specific books and have a specific publication date in column C, follow these steps:

    Steps:

    1. Select the column range B2:B16.
    2. Click Format > Conditional formatting.
    3. Under Format cells if, select Custom formula is and enter the following formula:
      =AND(OR($B2="Anna Karenina", $B2="The Open Door"), $C2=DATE(2010, 10, 15))
    4. Apply the desired formatting and click Done.

    This formula combines the AND and OR functions.

    The OR function checks if the book title in B2 matches “Anna Karenina” or “The Open Door”. It returns TRUE if either condition is met.

    The AND function returns TRUE if the OR function is TRUE and the publication date in C2 matches October 15, 2010.

    The DATE function is used to specify the date in the format DATE(year, month, day).

    Note: You can adjust the formula for different criteria and date formats.

    This method allows you to highlight cells based on multiple conditions in Google Sheets.

    Resources

    Prashanth KV
    Prashanth KV
    Your Trusted Google Sheets and Excel Guide Prashanth KV brings a wealth of experience in Google Sheets and Excel, cultivated through years of work with multinational corporations in Mumbai and Dubai. As a recognized Google Product Expert in Docs Editors, Prashanth shares his expertise through insightful blogging since 2012. Explore his blog for practical tips and guidance on maximizing your spreadsheet skills.

    Lookup Values Under Categories in Excel and Google Sheets

    We can use a combination of XLOOKUP and VLOOKUP in both Excel and Google...

    Extract Items Under a Category from the Same Column in Excel

    In Excel, you can use a combination of the XLOOKUP and DROP functions to...

    How to Create a Searchable Table in Excel Using the FILTER Function

    Finding specific records, or rows containing the required information, is straightforward in Excel using...

    Time Sequences in Excel by Minute, Hour, or Second Increments

    Creating time sequences, whether by hour, minute, or second increments in Excel, can be...

    More like this

    XMATCH Row by Row: Finding Values Across a Range in Google Sheets

    Using the BYROW function with XMATCH in Google Sheets allows us to match values...

    Limit Formula Expansion to a Specific Row in Google Sheets

    In this tutorial, I’ll explain how to limit the expansion of an array formula...

    3-D Referencing Structured Data Tables in Google Sheets

    When you have several tables within a single sheet—not across multiple sheets in a...

    51 COMMENTS

    1. Hi Prashanth,

      Thank you for taking a look.

      Here’s an example sheet – I have made it editable. So feel free to play around with it.

      – URL removed by Admin –

      Currently, the conditional formatting is ok for the green and light pink, but it’s the magenta/darker pink I’m trying to edit.

      It’s currently just set to highlight duplicates in col E, but I want to add a condition so that it only highlights the row with the duplicate value in col E and also has a row with a W in col H.

      If it’s not doable, then please don’t hesitate to say!

      Thanks again!

    2. Hi Prashanth,

      Cheers for the post, it’s informative, but I’m still a bit stuck.

      Is it possible to add a single formula to look at duplicates in a column, and if there’s a duplicate, highlight the entire row based on whether or not there’s a “W” in Col H?

      Happy to make an example if needed.

      Cheers.

    3. Hi,

      I have a range of data (A1:D4) containing random numbers.

      There is another range in A10:D14, which has another random numbers section.

      Question: how can I highlight cells in A1:D4 if numbers match any from A10:D14?

    4. Hi Prashanth,

      Thank you for the great tutorial.

      What I am trying to do is if the value of cell A1 is “Promo” and F1 is “Cancelled,” I want the background of A1 to be blue.

      I would appreciate it if you have any insight into how I could do this.

    5. Hi Prashanth,

      I am a trader in equities.

      I am using google sheets in my day-to-day use to track stocks. I stuck up at one point.

      My format is something like this below :

      Stock — Sector / Industry — Updated date & Time — Mkt. Price — Last Closing — Open — High — Low

      I want to highlight the name of the stock, which rises by (let’s say ) 2 % up or down from its open price.

      How can I reset my Google sheet to achieve the same?

      Regards,

    6. Hi Prashanth,

      I need help. I’m creating a tracker, and it’s a non-numerical value.

      Status 1:- My first condition is =$I2="Take Home Assessment" the entire row will be highlighted yellow (this one worked).

      But I have another condition. If the candidate failed the Take Home Assessment-

      Status 2: =$L2="Unsuccessful" the entire row should turn from yellow to grey.

      How can I overwrite the color/highlight of Status 1?

      • Hi, Maria Maria,

        As you may know, you require to add both the rules. The order of them must be as follows.

        Rule 1: =$L2="Unsuccessful"
        Rule 2: =$I2="Take Home Assessment"

        Note:- You can drag and drop the rules to change their order.

        • Hi Prashanth,

          Glad to hear from you.

          Rule 1: =$L2="Unsuccessful" (Grey) – this conditional format works if $I2 is empty.

          But if =$I2="Take Home Assessment" is applied, Rule 1 doesn’t work. I can select “Unsuccessful,” but it doesn’t turn the row to Grey 🙁

    7. Hi Prashanth, thank you so much for your great article!

      I’m trying to get column ‘E’ to highlight if columns AC/AE/AG/AG all contain ‘X’ but am struggling, what is the best way to address this? And/OR? IF?

        • Thanks for the reply Prashanth,

          I tried inputting that in my google sheets conditional formatting for column ‘E’ as a custom formula and it seems to be highlighting at random and everything but the lines that contain all 4 X in AC/AE/AG/AJ.

          • Hi, Amy Smith,

            Apply to range: E2:E, not (entire column E)

            I haven’t considered column AJ. So, here is the modified formula.

            =AC2&AE2&AG2&AJ2="xxxx"

            If the above doesn’t help, please share a sample Sheet via comment which won’t be published.

    8. I am wondering if you can help. I want to do something similar to this. From A1:B26, I have a list of criteria. Let’s say in Column A, I have a name, and in column B, I have a color, which can change based on other criteria and formulas I have set up.

      From A27:B, I have a list of data points. Let’s say I only want to highlight the data points that match A1 with the color listed in B2.

      • Hi, Davida,

        Formula rule for the range A27:Z

        =$B27=vlookup("Red",{$B$1:$B$26,$A$1:$A$26},2,0)

        Lookup criterion “Red” in B1:B26 and return the name from A1:A26. If that name matches in B27:B, it highlights.

        If this doesn’t help, you may share a sample of your sheet.

    9. Hi, Prashanth,

      I tried your formula above for more than 2 criteria. But it doesn’t seem to work. Don’t know where is my mistake. The formula is;
      =AND(OR(H3>8.01,H3 and <12.00 highlight RED. If C1=OUT, Value in H3:AM100 <17.3 highlight RED

      • Hi, Desmond,

        Thanks for sharing your example sheet. I accessed it and added the below two multiple criteria highlight rules.

        RED: If the drop-down in cell C1 has the value “IN”:

        =and(H3>8.01,H3<12,$C$1="IN")

        ORANGE: If the drop-down in cell C1 has the value "OUT".

        =and(len(H3),H3<17.3,$C$1="OUT")

        When you change "IN" to "OUT", you may be required to wait a few seconds for the cells to highlight as your sheet is slow responsive due to heavy formulas.

    10. Hello,

      I have been trying to put my scenario into sample formulas shown above and cannot figure it out.

      I have two columns that contain checkboxes – columns E & H. The text is Red at the beginning for any data entry, and there is a conditional formula coloring a row based on Column C (Last Name).

      So, when Column E is checked, I would like it to remove the row coloring. Then, when Column H is checked, I want it to change the text to Black.

      So, I can get EITHER of these rules individually but not both at the same time. Can anyone help?

    11. Hey there,

      I’m messing around with a Google Sheet’s conditional formatting and checkboxes. I’m wanting to change the color of a row based on what checkbox is checked (aka ‘cell’=TRUE).

      My range is A2:Y1503. I have my entire first row as a header. I’m using a custom formula and here it is:

      =$I2=TRUE

      I have columns I:N strictly for checkboxes. I want a row to change to another color if I2 and J2 are checked or only J2 is checked.

      What’s the correct formatting for the AND/OR?

    12. Hello, I was wondering if it would be possible to highlight a row based on two cells in the row when one of the cells let’s say G hits the same or less quantity as J as a reorder point?

    13. Hi,

      I have been looking for days to solve a problem with shading and filtering.

      I have a large spreadsheet with all sorts of data in it and I have added a help column to allow me to shade alternate group of rows based on a column’s data using the formula =MOD(IF(ROW()=2,0,IF(D2=D1,J1, J1+1)), 2)

      The problem is a need to filter the data all the time losing the alternate shading since the formula still counts hidden rows giving me same shade if the group in between is hidden.

      Please help to keep alternate shading grouped by column data regardless of filtering.

      I prepared a simplified copy of the spreadsheet in the link below.

      Note: Link copied then removed by admin.

      Thanks in advance!!

    14. Hi,

      Hoping for some help with conditional formatting of checkboxes.

      Column B is a checkbox for Priority tasks and will highlight the column C task if it is checked. Column D is a Completed checkbox that I am attempting to “strikethrough” column C task if it is checked.

      Basically, two different formulas in two different columns affecting a single third column.

      I can get them to work independently but if I have one of the checkboxes in column B checked (which causes column corresponding task in column C to be highlighted), then click on the checkbox in column D to indicate that the task is completed, it won’t produce the strikethrough that I need.

      Help, please!

      • Hi, Leah,

        I guess I have correctly interpreted your query.

        You have tick boxes in B2:B and D2:D, and the tasks to highlight are in C2:C, right?

        You want to highlight the tasks in C2:C in two ways (using tick boxes in two columns).

        Conditional Format Rule 1 for the Range C2:C.

        =AND(B2=TRUE,D2=TRUE)

        Formatting Style: Fill Color & Strike-through.

        Conditional Format Rule 2 for the Range C2:C.

        =B2=TRUE

        Formatting Style: Fill Color.

        Please make sure that the highlighting rules are positioned as per my order above. If not it won’t work.

    15. Can you please help me with my issue?

      I trying to do an alternate color formatting. I’ve added a new column (Column D) with values of 1 and 0 (0 change to the grey background while 1 retains a white background).

      So far that works, but I need another formatting conditions wherein if Column C is Yes, the entire row will be bolded and change to blue color?

      How can I achieve that? Is there a way I can send you screenshot/snapshot so you can better see the issue.

      Thanks.

    16. Ok. Scenario – I have a Spreadsheet in Google Drive that I have the conditional format in to change the entire row Blue if it contains a 1 in the Column K. (=$K2="1") – Range is A2:CJ3077 if it matters.

      I want to add another layer that says if the number in Column CJ is above 90 then change the color to Red.

      Is this possible?

      • Hi, Tasha,

        I could understand that the data range is A2:CJ. Follow the below formatting rules.

        Red Color (it must the the first rule):

        First select this range. In the conditional formatting use the custom formula =and($K2=1,$CJ2>=90). I guess that column A contains the number 1, not the string “1”. If it’s string change the formula as =and($K2="1",$CJ2>=90)

        Blue Color (second rule):

        Then add one more rule. In that, you can use another custom formula =$K2=1 or =$K2="1"

        Best,

      • Hi Denise,

        A Custom formula like the one below will highlight all the cells in column A if the values in B=25 and C=30.

        =and(B1:B=25,C1:C=30)

        You can play around with this formula.

    LEAVE A REPLY

    Please enter your comment!
    Please enter your name here

    This site uses Akismet to reduce spam. Learn how your comment data is processed.