excelexcel-formula

How to use Use a Formula to Determine Which Cells to Format to format a range of cells


enter image description here

I'm trying to create my own gantt chart with Excel as above.

I want to fill color for the cells in the zone of calendar with the help of "Conditional Formatting" but I don't know how to do it for a range of cells.

Here is what I've done:

Now, I'm trying to fill colors for the cells from H15 to N15 based on F15 and G15. In the above image, the cells from H15 to K115 sould be colorful.

I've googled a lot and I think I should set "Use a Formula to Determine Which Cells to Format" in "Conditional formatting".But I can only set color for some specific cell based on the value of another specific cell, I don't know how to set this for a range of cells.

I've set such a formula =AND($H$13+$H$14:$N$14-1 >= $F$15, $H$13+$H$14:$N$14-1 <= $G$15), which is applied to =$H$15:$N$22, but it doesn't work. enter image description here


Solution

  • The result of the formula must be a single TRUE or FALSE. The Apply to determine the cells where the formula is applied. With $ define the constant (not changed) row/column values which are not changed in the cell addresses.

    =(($H$13+H$14-1)>=$F15)*(($H$13+H$14-1)<=$G15)

    enter image description here

    To extend for more weeks two alternatives:

    Set the Apply to range for the desired size. H15:K115