# Highlight a set of rows in Excel based on date range

Hi, in this blog we take a look how we can highlight a set of rows in Microsoft Excel that fall between two dates.  This is inspired from Rodel Balasabas comment in my other post about highlighting a row in Excel. Thanks!

The final product looks as: Final product

Adding multiple conditions to Excel’s conditional format may prove difficult if not impossible at times.  Thus, one trick is to add a hidden column in your table that does all your conditional logic and then use the result of this formula to highlight your rows.  The screenshot below shows all the formulas in our sheet. Sheet formulas

Let’s see how we can do this together.

### Step 1

Put your data in a table: Our data

### Step 2

Create week start date and end date.  We will use formulas so that these are automatically updated every week.

The formula for start of week (starting on a Monday) is: =TODAY()-WEEKDAY(TODAY(),2)+1

The formula for end of week is: =TODAY()-WEEKDAY(TODAY(),2)+7 Adding start and end dates of current week.

### Step 3

Add a column so that it evaluates to whether the date we have in our schedule is between our start and end dates.  To do this, we will use a simple AND() function to check if the date at hand is greater or equal to the start of the week and less or equal to the end date of the week.  A typical formula for such logic is =AND(B5 >= \$D\$1, B5 <= \$D\$2). Adding logic that later will be used to indicate whether to highlight a row or not.

### Step 4

Now we can hide our test column and create a new formatting rule based on column C.  The formula for this rule will be =INDIRECT(“C”&ROW()).  For more details how to do this see other blog post Highlight a row in Excel based on a cell value.
{"ft_lang_label":"__label__en","ft_lang_prob":0.85099375,"math_prob":0.9585377,"size":1699,"snap":"2023-14-2023-23","text_gpt3_token_len":413,"char_repetition_ratio":0.107964605,"word_repetition_ratio":0.0,"special_character_ratio":0.23778693,"punctuation_ratio":0.08539945,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.98308736,"pos_list":[0,1,2,3,4,5,6,7,8,9,10,11,12],"im_url_duplicate_count":[null,5,null,5,null,5,null,5,null,5,null,5,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-03-28T11:31:27Z\",\"WARC-Record-ID\":\"<urn:uuid:f4f8009d-602d-4f10-9a2e-20fe925e157f>\",\"Content-Length\":\"37451\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:830fee87-71b1-400d-a214-7ffe05a8de22>\",\"WARC-Concurrent-To\":\"<urn:uuid:71b03536-39d4-4564-adf6-ceda0689f4b1>\",\"WARC-IP-Address\":\"207.180.230.131\",\"WARC-Target-URI\":\"https://www.clounce.com/office/highlight-a-set-of-rows-in-excel-based-on-date-range\",\"WARC-Payload-Digest\":\"sha1:3EAL2JEY76SJIO33NIDFEMJYFBD5TDXT\",\"WARC-Block-Digest\":\"sha1:63ON3Q7DNWKQ5MC4RSGWUSQC7YIGIB3W\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-14/CC-MAIN-2023-14_segments_1679296948858.7_warc_CC-MAIN-20230328104523-20230328134523-00019.warc.gz\"}"}