Gantt Chart with Conditional Formating

ebeyert

Active Member
Joined
Sep 15, 2006
Messages
287
Fact;<o:p></o:p>
I have setup a Chant Chart which have the following format; <o:p></o:p>
Cell A5 is Start Date.<o:p></o:p>
Cell B5 is Finish Data. <o:p></o:p>
Cell C5 I have the formula: =NETWORKDAYS(A5,B5) to calculate is duration based on 5days a week. <o:p></o:p>
<o:p> </o:p>
The graphical presentation of the Chant Chart starts at D5- The Chant Chart has the following format.<o:p></o:p>
D4 is the start if the first Monday of the year. <o:p></o:p>
D3 has the formula =WEEKNUM(D4)<o:p></o:p>
D2 has the formula= D4 where the cell format is mmm to represent the month. <o:p></o:p>
D1 has the formula= D4 where the cell format is date to represent the day/month/year. <o:p></o:p>
E1 has the formula=D1+1 to represent the following day/month/year.<o:p></o:p>
F1 has the formula=E1+1<o:p></o:p>
Etc<o:p></o:p>
<o:p> </o:p>
In D5 I have the conditional format: =AND(D$1>=$A5, D$1<=$A5+$C5-1) =Format is Gray. <o:p></o:p>
<o:p> </o:p>
Issue: <o:p></o:p>
The formula in D5 calculates with a 7days per week, so when I insert 7 Jan 08 in cell A5 and 4 Feb. 08 in cell B5 than C5 get the value 18, but my graphical chant Chart start at D5 but ends at 24 Jan. 08 in stead of 4 Feb.08. <o:p></o:p>
<o:p> </o:p>
Question: <o:p></o:p>
How can I resolve this?<o:p></o:p>
<o:p> </o:p>
Thanks in advantage.<o:p></o:p>
Regards,<o:p></o:p>
Ellerd Beijert<o:p></o:p>
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Hi Ellerd

Try for the conditional formatting formula in D5:

=AND(D$1>=$A5, D$1<=Workday($A5,$C5)-1)

P. S.

It could also be just

=AND(D$1>=$A5, D$1<=$B5)

but I used C5 as you did, I assumed you use it for a reason.
 
Last edited:
Upvote 0
PGC01,<o:p></o:p>
Thanks for you’re quick reply. <o:p></o:p>
One issue: When I add you’re formula: =AND(D$1>=$A5, D$1<=WORKDAY($A5,$C5)-1) I get the message: You may not use references to other worksheets or workbook for conditional formatting criteria?<o:p></o:p>
<o:p> </o:p>
I don’t have any link or references to other sheets or workbooks. Do you have any idea?<o:p></o:p>
Kind regards,<o:p></o:p>
Ellerd Beijert<o:p></o:p>
 
Upvote 0
I get the message: You may not use references to other worksheets or workbook for conditional formatting criteria?

I tested in xl2007. In previous versions you could not use Analysis Toolpak functions in conditional formatting.

One workaround is to define a name that calculates the Workday part. Since the formula uses relative addresses it's preferable to use the R1C1 notation.

This worked in xl2000.

Define a name,

Name: Workday1
Refers to: =WORKDAY(INDIRECT("RC1",FALSE),INDIRECT("RC3",FALSE))

Now in D5 use for the conditional formatting formula:

=AND(D$1>=$A5, D$1<=Workday1-1)


Another solution is to replace the function Workday by an equivalent formulation using just native functions.
 
Upvote 0

Forum statistics

Threads
1,215,771
Messages
6,126,799
Members
449,337
Latest member
BBV123

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