Conditional Formatting with Ghantt Chart- Copying to additional cells

justme

Well-known Member
Joined
Aug 26, 2002
Messages
729
Good morning everyone!
In row 5 I have calendar dates, in columns D & E I have projected start & end dates.
What I am trying to do is create a ghantt chart that will color in the dates in the row between the projected start/end dates listed in columns D & E.
I have the following conditional format in cell G8: =IF(AND(G5>=$D8), (G5<=$E8)). Works great. Now, how do I extend this conditional formula to include up to row 100 and to columns FV? I certainly don't want to format each cell! Thank you in advance!
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
If you select the WHOLE range you want to apply the Conditional Formatting to, and then write the Conditional Formatting formula as it applies to the very FIRST cell in your selected range, then if you have used absolute/relative range referencing correctly, Excel will automatically adjust the CF formula for all other cells in your selected range.

I always do this when I have to apply Conditional Formatting to a multi-cell range, and it works well, as long as I have written my formula correctly.
 
Upvote 0
Thank you for your reply Joe. I did try that, but the problem is this. Even without using the absolute references, the formula does not "advance" beyond G8,it only works properly in g8. And in the capture below I get some odd ball formatting in cells I10-I13. I can change the date in cell G5 to 9-15-23 and G8 formats correctly


Book1.xlsx
ABCDEFGHIJKLM
1
2
3Project Start:Mon, 8/28/2023
4Display Week:1August
528293031123
6TASKPHASEASSIGNED TOSTARTENDMTWTFSS
73033 Haas 5 axis
8Project 1 Pre-productionTBD9/11/239/26/23
9Production9/27/2310/14/23
10Project 2Pre-productionTBD10/14/2311/3/23
11Production11/4/2312/3/23
12Project 3Pre-productionTBD12/4/2312/18/23
13Production12/19/2312/28/23
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
G8:I13Expression=IF(G5>=D8,AND(G5<=E8))textNO
 
Upvote 0
You need to put the "$" in front of the row and columns that you want to lock down.
Since you always want to look at row 5 in the header, you want to lock that part down.
And since you always want to look columns D and E in your formula, you want to lock that part down.

Also, I am not sure why you have an IF there. I think all you need is an AND function (AND functions return boolean values of TRUE or FALSE).

So I think your formula needs to look like this:
Excel Formula:
=AND(G$5>=$D8,G$5<=$E8)

See here for a more detailed explanation on mixed cell references: Mixed Reference Excel - a Beginner's Guide.
 
Last edited:
Upvote 0
Solution
THANK YOU!!! Absolutely perfect!
Happy Labor Day weekend to you and all the other hard workers out there.
 
Upvote 0
I'm sorry, one more question. Is there a way to format the color differently for Production vs Pre-production?
 
Upvote 0
I'm sorry, one more question. Is there a way to format the color differently for Production vs Pre-production?
Sure. You would just create two rules, and have a different color for each.

So, for Production, you would just add one more condition:
Rich (BB code):
=AND(G$5>=$D8,G$5<=$E8,$B8="Production")

and for Pre-production:
So, for Production, you would just add one more condition:
Rich (BB code):
=AND(G$5>=$D8,G$5<=$E8,$B8="Pre-production")
 
Upvote 0
You are welcome.
Glad I was able to help!
 
Upvote 0

Forum statistics

Threads
1,215,091
Messages
6,123,062
Members
449,090
Latest member
fragment

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top