Highlight an Entire Row Based on Cell Value in Excel (Conditional Formatting)

Sumit Bansal
Written by

Sumit Bansal is the founder of TrumpExcel.com and a 13-time Microsoft Excel MVP. He started this site in 2013 to share his passion for Excel through easy tutorials, tips, and training videos, helping you master Excel, boost productivity, and maybe even enjoy spreadsheets!

Last updated

If you want to highlight an entire row based on the value in one cell, regular Conditional Formatting will not do it for you.

That’s because Conditional Formatting normally looks at each cell on its own, so it colors that one cell and leaves the rest of the row alone.

The fix is to write the rule as a formula and lock the column reference. Below I have a dataset where every row with Bob as the sales rep is highlighted.

Orders dataset with every row for sales rep Bob highlighted in yellow

In this article, I’ll show you how to highlight rows based on text, numbers, dates, multiple conditions, a checkbox, and a drop-down selection.

Click here to download the Example file and follow along

Highlight an Entire Row Based on a Text Value

Let’s start with the most common case, which is highlighting a row when a cell in it contains a specific name.

Below I have an orders dataset, and I want to highlight every row where the sales rep is Bob.

Orders dataset with order date, order ID, sales rep, quantity, product and sale value

Here are the steps to highlight the rows:

  1. Select the entire dataset (A2:F17 in this example), but not the header row.
The data rows A2:F17 selected, with the header row left out of the selection
  1. On the Home tab, in the Styles group, click Conditional Formatting, then click New Rule.
The Conditional Formatting drop-down on the Home tab with New Rule selected
  1. In the New Formatting Rule dialog box, click ‘Use a formula to determine which cells to format’.
The New Formatting Rule dialog box with Use a formula to determine which cells to format selected
  1. In the formula field, enter the formula =$C2="Bob"
The formula =$C2="Bob" entered in the New Formatting Rule dialog box
  1. Click the Format button, go to the Fill tab, and pick the color you want the row highlighted in.
The Fill tab of the Format Cells dialog box with a yellow fill color picked
  1. Click OK, and then click OK again.

Every row where the sales rep is Bob is now highlighted.

All five rows where the sales rep is Bob highlighted across every column

How does it work?

Conditional Formatting runs the formula once for every cell in the range you selected, and colors the cell whenever the result is TRUE.

The whole trick is the dollar sign in =$C2="Bob". It locks the column to C, so every cell in a row looks at the sales rep name in that same row.

So when Excel checks cell A2, it reads C2. When it checks F2, it still reads C2. All six cells in row 2 get the same answer, which is why the entire row is colored.

The row number has no dollar sign, so it moves down as Excel works through the range. Cells in row 3 read C3, cells in row 4 read C4, and so on.

Related: Absolute, Relative, and Mixed references in Excel.

The same locked-column trick is what drives conditional formatting based on another column, and it works the same way when you want the rule to read a value in another cell.

Why Only One Cell Gets Highlighted (and How to Fix It)

This is the single most common thing that goes wrong, so it’s worth covering before we get to the other criteria.

You write the rule, click OK, and only the sales rep column turns yellow. The rest of the row stays plain.

Only the Sales Rep column is highlighted while the rest of each row stays plain

There are only two things that cause this, and both are easy to check.

The rule is applied to one column instead of the whole range. If you had only column C selected when you created the rule, Excel will only ever format column C. That’s the case in the screenshot above.

The column reference isn’t locked. If you entered =C2="Bob" instead of =$C2="Bob", the reference slides sideways as Excel works across the row. Cell A2 checks C2, but cell B2 checks D2 and cell C2 checks E2.

That second one is worth knowing because of how odd it looks. Only column A gets colored, since A2 is the one cell whose formula still points at the name.

Here is how to repair a rule you have already created, without deleting it:

  1. On the Home tab, click Conditional Formatting, then click Manage Rules.
The Conditional Formatting drop-down with Manage Rules selected
  1. If your rule isn’t listed, switch ‘Show formatting rules for’ to This Worksheet.
  1. In the ‘Applies to’ box for your rule, change the range to cover every column you want colored (A2:F17 here), then click Apply.
The Conditional Formatting Rules Manager showing the Applies to range set to A2:F17

The rule now covers the full width of the data, and the whole row gets highlighted.

The whole row highlighted now that the rule applies to the full width of the data

Pro Tip: The formula in a Conditional Formatting rule is always written for the top-left cell of the ‘Applies to’ range. If your range starts at row 2, write the formula for row 2. Starting the range at A1 but writing =$C2 is another reason rules land on the wrong rows.

If your rule is misbehaving in some other way, I have a separate guide on Conditional Formatting not working that covers the rest of the causes.

Highlight Rows Where a Cell Contains Specific Text

The formula we used so far is an exact match. =$C2="Bob" is TRUE only when the cell holds exactly Bob and nothing else.

Quite often you want a partial match instead, where the cell contains the text somewhere inside a longer entry.

Below is the same dataset, and this time I want to highlight every row where the product is a monitor. The product names are things like ’27-inch Monitor’, so an exact match won’t find them.

The Product column showing full names such as 27-inch Monitor and Wireless Keyboard

Here is the formula to use:

=ISNUMBER(SEARCH("monitor",$E2))
The formula =ISNUMBER(SEARCH("monitor",$E2)) entered in the New Formatting Rule dialog box

The SEARCH function looks for “monitor” inside the product name and returns the position where it found it. When the text isn’t there at all, it returns an error instead.

ISNUMBER then turns that into the TRUE or FALSE that Conditional Formatting needs. A position is a number, so a match gives TRUE, and the error gives FALSE.

The three rows whose product name contains the word monitor highlighted

Pro Tip: SEARCH ignores upper and lower case, so “monitor” also matches “Monitor”. If you need the match to be case sensitive, swap SEARCH for FIND and keep everything else the same.

Highlight Rows Based on a Number Criteria

The same approach works for numbers. You only change what the formula compares.

Below is the same orders dataset, and I want to highlight every row where the quantity is more than 15.

The orders dataset with the Quantity column in column D

Select A2:F17, go to Home, Conditional Formatting, New Rule, and choose ‘Use a formula to determine which cells to format’. Then enter this formula:

=$D2>15
The formula =$D2>15 entered in the New Formatting Rule dialog box

Column D holds the quantity, and the dollar sign locks it the same way it did for the name. Set a fill color, click OK, and every row with a quantity above 15 is highlighted.

If you also want to catch rows where the quantity is exactly 15, use =$D2>=15 instead.

Highlight rows based on a date

Dates are just numbers in Excel, so a date criteria works the same way.

To highlight every row where the order date is after 15 August 2026, use this formula:

=$A2>DATE(2026,8,15)
Every row with a quantity above 15 highlighted, with the quantity of 15 left out

The DATE function builds the cutoff date from the year, month, and day, which is safer than typing a date into the formula and hoping Excel reads it the way you meant.

For deadline and overdue tracking specifically, I have a separate guide on highlighting dates before today.

Pro Tip: For a rolling window that updates itself, use TODAY instead of a fixed date. =$A2>=TODAY()-30 highlights every row from the last 30 days, and it stays correct every time you open the file.

Click here to download the Example file and follow along

Highlight Rows Based on Multiple Criteria (AND/OR)

You can also check more than one condition before a row gets highlighted.

Below is the same dataset, and this time I want to highlight rows only where the sales rep is Bob and the quantity is more than 15.

Every row with an order date after 15 August 2026 highlighted

Create the rule the same way as before, and use this formula:

=AND($C2="Bob",$D2>15)
The orders dataset before applying a rule with two conditions

AND returns TRUE only when both conditions are met, so Bob’s smaller orders stay unhighlighted.

The formula =AND($C2="Bob",$D2>15) entered in the New Formatting Rule dialog box

If you want either condition to be enough, use the OR function instead. This formula highlights a row when the sales rep is Bob or the quantity is more than 20:

=OR($C2="Bob",$D2>20)
Only the three rows where the sales rep is Bob and the quantity is above 15 are highlighted

Both functions take more than two conditions, so you can keep adding checks separated by commas.

Highlight Rows in Different Colors Based on Multiple Conditions

Sometimes one color isn’t enough and you want the rows banded by size.

Below is the same dataset, and I want quantities above 20 in green, and quantities above 15 but not above 20 in orange.

Rows highlighted where the sales rep is Bob or the quantity is above 20

This needs two rules, and the order they sit in matters. Start with the orange one:

  1. Select A2:F17, then go to Home, Conditional Formatting, New Rule, and choose ‘Use a formula to determine which cells to format’.
  1. Enter the formula =$D2>15, click Format, set the fill to orange, and click OK twice.
The orders dataset before adding the two colored rules
  1. With the data still selected, open Conditional Formatting again and click New Rule, then enter the formula =$D2>20 and set the fill to green.
The Fill tab with orange picked for the rule that highlights quantities above 15
  1. Open Conditional Formatting, click Manage Rules, and make sure the green rule sits above the orange one. Use the Move Up and Move Down arrows if it doesn’t.
The Fill tab with green picked for the rule that highlights quantities above 20

Rows above 20 are now green, and rows between 16 and 20 are orange.

The Rules Manager showing the green rule above the orange rule

Why the order matters

A quantity of 24 satisfies both rules. It’s above 15 and it’s also above 20.

When two rules want to set the same thing, which is the fill color here, the rule higher up the list wins.

So with green on top, a quantity of 24 comes out green. Flip the order and every qualifying row turns orange, because the =$D2>15 rule is now the one deciding the color for all of them.

Highlight Rows Where Any Cell is Blank

If you’re checking a dataset for gaps, you can highlight any row that has an empty cell in it.

Below is the same dataset with a couple of entries missing, and I want those rows flagged.

Rows above 20 highlighted green and rows from 16 to 20 highlighted orange

Create the rule the same way, and use this formula:

=COUNTBLANK($A2:$F2)>0
The orders dataset with two missing entries, a blank product and a blank sale value

COUNTBLANK counts the empty cells in that row. If the count is more than 0, there’s a gap somewhere and the row gets highlighted.

Note that both the column letters are locked here, but the row numbers are not. That keeps the formula looking at the full width of the row it’s currently checking.

The formula =COUNTBLANK($A2:$F2)>0 entered in the New Formatting Rule dialog box

To do the opposite and highlight only the complete rows, change the comparison to =COUNTBLANK($A2:$F2)=0.

And if you only care about one column being filled in, point the formula at that column instead. =$F2<>"" highlights every row that has a sale value.

Related: read this tutorial if you only want to highlight the blank cells rather than the whole row.

Highlight Rows in an Excel Table (So New Rows Are Covered Too)

There’s one annoying thing about everything we’ve done so far. The rule covers A2:F17 and nothing else, so a row you add underneath doesn’t get highlighted.

Converting the data into an Excel Table fixes that. The rule grows with the table.

Below is the same dataset, converted into a table by selecting it and pressing Control + T. Here is the full guide on how to create an Excel table.

The two rows containing an empty cell highlighted in orange

Now select the table’s data rows and create the rule exactly as before:

=$C2="Bob"

Set your fill color and click OK. The rows with Bob get highlighted, which is what we’d expect.

The orders data converted into an Excel table with banded rows and filter arrows

The useful part happens next. Type a new order in the row below the table, and the table expands to include it. The Conditional Formatting rule expands with it, so a new Bob row is colored the moment you enter the name.

The rows for Bob highlighted inside the Excel table

Pro Tip: Use the normal =$C2 style reference here, not a structured reference. Excel rejects [@[Sales Rep]] inside a Conditional Formatting rule, even though it works fine in a worksheet formula.

Highlight a Row When a Checkbox is Checked

If you’re keeping a task list or an order tracker, a checkbox is a nicer way to mark a row than typing Yes or No.

Excel now has real in-cell checkboxes, and because a checked box is simply the value TRUE, Conditional Formatting can read it like any other cell.

Below is the same dataset with a Shipped column in G, and I want the whole row highlighted once an order is marked as shipped.

A new order typed below the table, with the new row for Bob highlighted automatically

Here are the steps:

  1. Select G2:G17, then on the Insert tab, in the Controls group, click Checkbox.
The orders dataset with a Shipped column of in-cell checkboxes, some of them ticked
  1. Select A2:G17, then go to Home, Conditional Formatting, New Rule, and choose ‘Use a formula to determine which cells to format’.
  1. Enter the formula =$G2=TRUE, set a fill color, and click OK twice.

Now ticking a box highlights that row straight away, and unticking it clears the color.

The Checkbox button in the Controls group on the Insert tab

In-cell checkboxes are available in Excel for Microsoft 365 on Windows and Mac.

On older versions you would need a Form Control checkbox linked to a cell, and I cover that in my guide on how to insert and use a checkbox in Excel.

Highlight Rows Based on a Drop-Down Selection

In every method so far, the condition has been typed into the rule itself. Changing it means opening the dialog box again.

You can make it interactive instead, so you pick a name from a drop-down and the matching rows light up.

Below is the same dataset with a drop-down in cell H2, and the rows update as soon as I choose a different name.

Every row with a ticked checkbox highlighted across all seven columns

Here are the steps:

  1. Create a drop-down list in cell H2 with the sales rep names. Here is a detailed guide on how to create a drop-down list in Excel.
The drop-down in cell H2 open, showing the four sales rep names
  1. Select A2:F17, then go to Home, Conditional Formatting, New Rule, and choose ‘Use a formula to determine which cells to format’.
  1. Enter the formula =$C2=$H$2, set a fill color, and click OK twice.
The formula =$C2=$H$2 entered in the New Formatting Rule dialog box

Pick any name from the drop-down and the matching rows are highlighted right away.

With Bob picked in the drop-down, all five of his rows are highlighted

The drop-down cell is the only reference that’s fully locked with =$H$2. Every cell in the data needs to look at that one cell, so both the column and the row are pinned.

If the list of names is long, you can build a drop-down list with search suggestions and the rule will keep working the same way.

Quick Reference: Which Formula to Use

Here is every formula from this article in one place. In each case the rule is created with ‘Use a formula to determine which cells to format’, and ‘Applies to’ covers the full width of your data.

What you want to highlightFormula
Rows where a cell equals specific text=$C2="Bob"
Rows where a cell contains text anywhere in it=ISNUMBER(SEARCH("monitor",$E2))
Rows above a number=$D2>15
Rows after a date=$A2>DATE(2026,8,15)
Rows from the last 30 days=$A2>=TODAY()-30
Rows meeting two conditions=AND($C2="Bob",$D2>15)
Rows meeting either condition=OR($C2="Bob",$D2>20)
Rows with any empty cell=COUNTBLANK($A2:$F2)>0
Rows with no empty cells=COUNTBLANK($A2:$F2)=0
Rows where a checkbox is ticked=$G2=TRUE
Rows matching a drop-down selection=$C2=$H$2

Things to Keep in Mind

A few things that will save you some time when you’re setting these up.

Write the formula for the first row of your data. If your data starts in row 2, the formula uses row 2. If it starts in row 5, use row 5. Getting this wrong shifts every highlight up or down.

Don’t include the header row in the selection. Headers are text, so a rule like =$D2>15 will treat them oddly and can color the header along with the data.

Conditional Formatting sits on top of manual fill colors. It doesn’t erase them. If a row looks wrong, check whether someone applied a fill color by hand underneath the rule.

Copying cells copies the rules too. Pasting a highlighted row somewhere else brings the rule with it and can leave you with a messy pile of near-identical rules in Manage Rules.

Text comparisons ignore case. =$C2="Bob" also matches “bob” and “BOB”. To make it case sensitive, use =EXACT($C2,"Bob") instead.

Copying cells copies the rules too. Pasting a highlighted row somewhere else brings the rule with it. If that is what you want, here is how to copy conditional formatting to another cell on purpose.

You can act on the highlighted rows. Once the colors are on, you can sort by color to group them together, or delete rows based on the cell value if the highlight was really a shortlist for removal.

To start over, clear the rules rather than the fill. Clearing the fill color does nothing to a conditional format. Here is how to remove conditional formatting in Excel.

If you want to color alternate rows rather than rows matching a value, that’s plain banding and it needs a different formula. I cover it in Highlight Every Other Row in Excel.

If you want to highlight the row you’re currently clicked in rather than rows matching a value, that’s a different job again, and I cover it in Highlight Active Row/Column in a Data Range.

Interested in learning more on how to search and highlight in Excel? Check the below videos.

These are the ways I use to highlight rows based on a cell value in Excel. I hope you found this article helpful.

Other Excel Articles You May Also Like:

Sumit Bansal

Sumit Bansal

13x Microsoft Excel MVP

Hey! I'm Sumit Bansal, founder of trumpexcel.com and a Microsoft Excel MVP. I started this site in 2013 because I genuinely love Microsoft Excel (yes, really!) and wanted to share that passion through easy Excel tutorials, tips, and Excel training videos. My goal is straightforward: help you master Excel skills so you can work smarter, boost productivity, and maybe even enjoy spreadsheets along the way!

67 thoughts on “Highlight an Entire Row Based on Cell Value in Excel (Conditional Formatting)”

  1. Kind of worked. Selected rows, used basic format of your rule “=$C2=”Bob”. However it highlighted the row above the first instance of “Bob” and didn’t highlight the last instance of “Bob”.

    Reply
  2. I need help! example…I need a format which shows if any cells in the whole of row 2 say YES (could be more than 1) then I need a visual highlighted cell at the start of that row to flag and tell me I need to look through row 2 (because there a yes along there somewhere).

    Reply
  3. I followed the first one highlight based on a text value it almost worked but it’s highlighting the row above the one which has the text value in. No idea what I did wrong.

    Reply
  4. Hello,

    My Formatting only seems to work for the first 3 rows, I have tried everything.

    Other spreadsheets where I have used this formula work just fine.
    Would anyone know what the issue may be?

    I select the table, new rule and add: =$b6=”APPROVED”
    2 out of 18 work, the rest remain white.

    Reply
  5. Thank you for explaining WHY the formula does what it does. Understanding why cells behave the way they do is so key to remembering how to make them do it!

    Reply
  6. If I have a row of 5 cells containing numbers, how can I format it to show where more than one of the cells are greater than zero? the cell content is dynamic!

    Reply
  7. It works perfectly on a local excel file but stops working when that is uploaded on SharePoint. Any idea how to fix it?

    Reply
  8. Im trying to apply this rule on a drop down list, to color the entire row based on the options in the list “in process – on hold…” however its not working when typing the text between ” ” i get an error. any suggestions please?

    Reply
  9. How can i highlight a certain number of rows and columns in a range based on user input? For instance i have a 10×10 range and the user inputs “3” for rows and “5” for columns. How can i turn the cells in the first 3 rows and 5 columns in my range yellow.

    Reply
  10. Is there a way to highlight a whole row if /any/ value is entered into a cell? For instance: I have a column of “Rejection Reasons” there are any number of different reasons for rejecting a thing (too many for a drop down list), but I want to highlight the row if the thing was rejected for any reason. Can I do that? Basically the opposite of highlighting based on a blank cell.

    Reply
  11. How do I do highlight the entire row directly based on the value I select from the drop-down menu? E.G. not having a SEPARATE drop-down menu: this example, make the cells in the “Sales Rep” column drop downs.

    Reply
    • Wouldn’t you just highlight based on specific text? Above, the goal of highlighting based on a drop down selection is to show the rows that contain that text. It sounds like you just want different colors for different Sales Reps, which you could do by using the first tutorial provided here (highlight specific text) where each Rep has their own color.

      Reply
  12. I got the conditional formatting to work for my pivot. However when any changes are made to the data displayed (e.g., collapsing a row expansion) all the CF rules are reset to apply to the first row in the PT. I using $A$10:$M$308 for the range of the CF; should I somehow do this differently?

    Reply
  13. I am having a problem using Conditional formatting to find cells with unique values. I have 3 columns across my spreadsheet (D, E & F). I want to compare the 3 values in every row separately. Conditional formatting works great, 1 row at a time. How can I copy the formula down my entire spreadsheet?

    Reply
  14. I have a problem with this. When I follow the instructions, the whole table is highlighted, but not only one row. What am I doing wrong?

    Reply
  15. I followed your instructions and it worked for =$F2=”N/A” Then, I tried adding another formula for a new word =$F2=”PENDING” and it didn’t work anymore. What is the best way to resolve my issue? Thanks in advance

    Reply
    • The only thing I can think of is to double check what the formula applies to. If all your data is from A2 down and across to M67, go into the Conditional Formatting drop down, select Manage Rules …, and ensure the Applies to column next to your formulas lists =$A$2:$M$67 so that the formula covers your whole table.

      Reply
  16. Wow!! great tutorial. I knew conditional formatting but did not know that one could do so much. Thanks!!

    Reply
  17. I was actually looking to find out how to highlight a cell based on if a number was greater then or equal to a number in the same row, not a static number, and if it was lower than a number in the same row. I was able to use your formulas here to discover it. If anyone else needs this, I selected my area I wanted to become highlighted, drop down conditional formatting, manage rules, new rule, went to use a formula to determine which cells to format, and then used the following formulas for each rule:

    =$E2=$C2

    This will cause the formula to look at the two corresponding numbers, so for me, if the generated number is greater than the estimated number, it’s green. Lower than the estimated number, it’s red. Hope this helps someone else out there.

    Reply
    • Apparently it didn’t format it properly, the formulas are

      =$E2[LESS THAN]$C2
      =$E2[GREATER THAN]=$C2

      Hopefully this will show up.

      Reply
  18. Need to know how to highlight a row when the first a cell in column A contains a specific word (not =). What if Bob Dylan? Need whole row highlighted when the cell contains “Bob” regardless of last name or other words contained w/in the same cell.

    Reply
    • Ruth, try putting “*Bob*” for the input instead. If anything comes before or after Bob it will be highlighted, so it could be Bob Dylan or Dylan, Bob or Dylan, Bob J. and it will highlight.

      Reply
  19. I have a column which formats the cell to R/A/G based on priority, how can I also apply another format to make the whole line grey when it is complete, this would be a separate column.

    Reply
    • Create a conditional formatting rule for complete and make sure it is listed ABOVE your priority filter in the list of conditional formats applied to that area.

      Reply
  20. Great tutorial I have always had trouble getting Conditional Formatting to work and it work first time using your tutorial. Don’t know why others say it doesn’t work.

    Reply
  21. It should be $D1, $D2 highlights the next row instead. Also you need to say that is applies to all the sheet

    Reply
  22. How can you do this if you want a row to turn a certain color as soon as on cell is populated? In my case it is populated by a date.

    Reply
  23. Is there a way to do the first method, but as you go?

    Basically a way that you can automatically have the row fill based on one cell, but not have to do the format every time and have this happen as you fill in your spread sheet?

    Reply
    • Once you create the rule, you have to change the area it applies to so that it covers your entire table. In the “Conditional Formatting Rules Manager” you’ll select the applicable area for that rule under “Applies to”.

      Reply
    • Once you create the rule, you have to change the area it applies to so that it covers your entire table. In the “Conditional Formatting Rules Manager” you’ll select the applicable area for that rule under “Applies to”.

      Reply
  24. doesn’t work. tried the first example and it highlighted the row ABOVE where the selected text appeared.

    Reply
  25. This did not work as I wanted to shade rows where the content was in a ‘Day column to shade rows with ‘Friday’ in them, but the cell was derived by a formula ‘=WEEKDAY(A6)’ so it doesn’t recognise the cell is a Friday

    Reply
  26. It did not work. I have a table(which I then changed back to a range) from A2 to L371. My formula was =L$13=”Inactive”. Column L has blank cells, cells with the word Active, and cells with the word “Inactive”. This method, highlighted mostly cells that said Active, ?? I then capitalized all the INACTIVE rows – still nothing. I’m so confused. Why this didn’t work – does the reference cell need to be the in the beginning?

    Reply
    • You put the dollar sign on the row number instead of the column number which means it will only look at the 13th row when evaluating the formatting.

      Reply
  27. this formula has 2 typos: the quotation marks are closing quotations. Delete these in this formula and replace them and type fresh quotations around the text “Bob”

    Reply
  28. Highlight Rows Based on a Text Criteria not working for whole row & Also not automatically applies to whole table…

    Reply
  29. Is there a typo in the first explanation (Highlight based on Text) as to which cells you select the formula to apply to?

    Reply

Leave a Comment

Get the FREE 51 Excel Tips Ebook

Enter your details and the free PDF is on its way to your inbox.

Hmm, that didn't go through. Please check your email and try again.

No spam. You'll also get my weekly Excel newsletter. Unsubscribe anytime.

Check your inbox!

The ebook is on its way to your email. It usually lands within a couple of minutes.