# Highlight the cells in a row based on given days

#### bharath

##### Member
Hi,

Here i am enclosing excel file

thank you

#### Attachments

• 9.7 KB Views: 9

#### deciog

##### Active Member
bharath

In Custom formatting put this formula
=IF(C\$1>=\$A2,IF(C\$1<=\$B2,1,0), 0)

Decio

• herofox

#### herofox

##### Active Member
thanks mr deciog
elso you can to use this
Code:
``=AND(C\$1>=\$A2,C\$1<=\$B2)``

#### Attachments

• 11.3 KB Views: 6
• deciog

#### deciog

##### Active Member
herofox

Good simpler solution

Thank you

Decio

• herofox

#### Peter Bartholomew

##### Well-Known Member
It is a shame that conditional formatting is so antiquated. To use the condition within a formula one only needs a single dynamic array formula
= (start<=day)*(day<=end)
entered in cell C2. Because conditional formatting does not accept named ranges as the region to which the formatting is applied, much less dynamic ranges, nor does it apply Boolean array calculations correctly, one is reduced to relative referencing. I defined a named formula 'hightlight?' by
= (@start<=@day)*(@day<=@end)
and based the conditional formatting on that.

• deciog

#### bharath

##### Member
bharath

In Custom formatting put this formula
=IF(C\$1>=\$A2,IF(C\$1<=\$B2,1,0), 0)

Decio
thanks, its working

#### bharath

##### Member
thanks mr deciog
elso you can to use this
Code:
``=AND(C\$1>=\$A2,C\$1<=\$B2)``
thanks herofox

Peter

Simpler good

Decio