# Highlight a row in Excel based on a cell value

In this blog entry we take a look how to highlight a row in a Microsoft Excel table based on a cell value.  First we take a look at the steps required and then we take an example to see it in practice.   We will use the “Conditional Formatting” feature of Microsoft Excel.

Steps to highlight a row in Microsoft Excel:

1. Select the data (table) you want to apply the highlight to.
2. Go to the “Conditional Formatting” option and select “New Rule”.
3. Select the “Use a formula to determine which cells to format”.
4. Put in the formula: =INDIRECT(“<column>”&ROW())=<value>.  Where column is the column of which the value is to be compared, and value is the value to compare to.
5. Click on the “Format” button to specify how you want the row highlighted.
6. Click “Ok”.

## Example

Let’s take a look how this is done in practice. For this example we will use a table with Projected and Actual costs for Project X.  We want to highlight the row that indicates the cost of the current week.  A sample table is show in Figure 1.

### Step 1

Select the table you want to format: Figure 2: Table selection

### Step 2

Go to the “Conditional Formatting” option and select “New Rule”. Figure 3: Selecting “New Rule...” from the “Conditional Formatting” option

### Step 3

Select the “Use a formula to determine which cells to format”.

### Step 4

Put in the formula: =INDIRECT(“B”&ROW())=\$C\$3. See Figure 4. Note that “B” is the column we want to compare and cell \$C\$3 contains the value we want to compare to.  The value of this cell is automatically updated every week with the week number.  To do this we use the formula =WEEKNUM(NOW(),2) as indicated in Figure 5.  If for example, you want to highlight all the rows that have a future week number, that is, all those whose week number is greater than the current week number, you will replace the equal comparison (=) to a greater than (>) comparison.  Then, the formula will read =INDIRECT(“B”&ROW())>\$C\$3. Figure 4: Typing in the formula Figure 5: Formula to display the current week’s number

### Step 5

The final step is to select the way you want to format your row. Figure 6: Row formatting

### Step 6

When you are satisfied with the formatting, hit the OK button and you are done.  Figure 7 shows the final result. Figure 7: Final result
{"ft_lang_label":"__label__en","ft_lang_prob":0.8536885,"math_prob":0.9494574,"size":2006,"snap":"2023-14-2023-23","text_gpt3_token_len":500,"char_repetition_ratio":0.12737262,"word_repetition_ratio":0.076712325,"special_character_ratio":0.24775673,"punctuation_ratio":0.09178744,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9955241,"pos_list":[0,1,2,3,4,5,6,7,8,9,10,11,12],"im_url_duplicate_count":[null,4,null,4,null,4,null,4,null,4,null,4,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-05-28T02:14:06Z\",\"WARC-Record-ID\":\"<urn:uuid:cc3152cd-e1fd-432a-8049-7f54b8ae2552>\",\"Content-Length\":\"37896\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:ff303c42-eb8b-4220-877b-17bdc9247ee3>\",\"WARC-Concurrent-To\":\"<urn:uuid:e18efe76-9cd5-4861-809a-b988ab17a476>\",\"WARC-IP-Address\":\"207.180.230.131\",\"WARC-Target-URI\":\"https://www.clounce.com/office/highlight-a-row-in-excel-based-on-a-cell-value\",\"WARC-Payload-Digest\":\"sha1:UQ72TDB4K7PGS5SHZL6MINW7DSA3SFKO\",\"WARC-Block-Digest\":\"sha1:WR2DGGQII4MPSCRRB4NCVFMZTTVVGFPX\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-23/CC-MAIN-2023-23_segments_1685224643462.13_warc_CC-MAIN-20230528015553-20230528045553-00753.warc.gz\"}"}