Conditional formatting for project planning

MrTomB

New Member
Joined
Jul 16, 2018
Messages
10
Hi

I want a really basic sheet that i can fill in a project with its start and finish dates and see cells colour based on the dates enter

See attached, i want the yellow to happen automatically

Eventually i will have each team fill in a tab and then a master tab that consolidates it all

Thanks
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Welcome to the Board!

You cannot upload files to this site. But there are tools you can use to post screen images. They are listed in Section B of this link here: http://www.mrexcel.com/forum/board-a...forum-use.html.
Also, there is a Test Here forum on this board that you can use to test out these tools to make sure they are working correctly before using them in your question.
 
Upvote 0
Hi, not a great start, cannot add images and company wont allow those downloads, does this work?

[TABLE="width: 1315"]
<tbody>[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="colspan: 4"]2018[/TD]
[TD="colspan: 4"]2019[/TD]
[TD="colspan: 4"]2020[/TD]
[TD="colspan: 4"]2021[/TD]
[/TR]
[TR]
[TD]Project[/TD]
[TD]Start[/TD]
[TD]Finish[/TD]
[TD]Q1[/TD]
[TD]Q2[/TD]
[TD]Q3[/TD]
[TD]Q4[/TD]
[TD]Q1[/TD]
[TD]Q2[/TD]
[TD]Q3[/TD]
[TD]Q4[/TD]
[TD]Q1[/TD]
[TD]Q2[/TD]
[TD]Q3[/TD]
[TD]Q4[/TD]
[TD]Q1[/TD]
[TD]Q2[/TD]
[TD]Q3[/TD]
[TD]Q4[/TD]
[/TR]
[TR]
[TD]Project 101[/TD]
[TD="align: right"]01/01/2018[/TD]
[TD="align: right"]02/02/2019[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Project 102[/TD]
[TD="align: right"]01/01/2018[/TD]
[TD="align: right"]02/02/2020[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Project 103[/TD]
[TD="align: right"]01/01/2018[/TD]
[TD="align: right"]02/02/2021[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
Yes, we can see that.
In what cell is the Project 101 for Q1 2018 located?
Is it cell D3? If not, what cell are you using?
I am asking because I am trying to incorporate the relative column into the formulas.
 
Upvote 0
Hi Joe

The cell i think you are referring to is D3. So this would be the first highlight cell for project 101

Hope the formula isnt too complex so i can tweak it further down the line ;)


Thanks Tom
 
Upvote 0
Hope the formula isnt too complex so i can tweak it further down the line
Its long, though not necessarily complex.

So, in your example, select cells D3:S5 (the range you want to apply the Conditional Formatting to), and then enter this Conditional Formatting formula:
Code:
=AND($B3<=DATE(2017+INT(COLUMN()/4),(MOD(COLUMN(),4)*3)+4,0),$C3>=DATE(2017+INT(COLUMN()/4),(MOD(COLUMN(),4)*3)+1,1))
and choose your yellow formatting option.

Note that the formula currently has the year piece hard-coded in there. We could use the years found in row 1, but I would recommend getting rid of the merged cells, and use the "Center Across Selection" formatting option instead. Merged cells cause numerous problems, and should really be avoided!
See: https://www.atlaspm.com/toms-tutori...er-across-selection-instead-of-merging-cells/
 
Upvote 0
Note that the formula currently has the year piece hard-coded in there. We could use the years found in row 1, but I would recommend getting rid of the merged cells, and use the "Center Across Selection" formatting option instead. Merged cells cause numerous problems, and should really be avoided!
See: https://www.atlaspm.com/toms-tutori...er-across-selection-instead-of-merging-cells/


Ok, lesson learnt on the very tempting merge and centre button! how would i remove the hard coding on the year 2017?

Thanks for the help to this point though!
 
Upvote 0
how would i remove the hard coding on the year 2017?
Assuming the first year is being placed in cell D1, and they always go in consecutive order, then use this:
Code:
=AND($B3<=DATE($D$1+INT(COLUMN()/4)-1,(MOD(COLUMN(),4)*3)+4,0),$C3>=DATE($D$1+INT(COLUMN()/4)-1,(MOD(COLUMN(),4)*3)+1,1))
 
Last edited:
Upvote 0
Assuming the first year is being placed in cell D1, and they always go in consecutive order, then use this:
Code:
=AND($B3<=DATE($D$1+INT(COLUMN()/4)-1,(MOD(COLUMN(),4)*3)+4,0),$C3>=DATE($D$1+INT(COLUMN()/4)-1,(MOD(COLUMN(),4)*3)+1,1))


Wow, now whats the best way of understanding what this formula does so when i make changes i know how to edit? I have basics in excel functions
 
Upvote 0
Basically, here is what we are trying to do:
Check to see if BOTH of the following conditions are true:
- The "Start" date (column B) is before (or on) the last day of the quarter we are looking at
- The "Finish" date (column C) is after (or on) the first day of the quarter we are looking at

So, we need to build these quarter start/end dates. We do that by using the the DATE function, which has the format:
=DATE(year, month, day)

The key to getting this to working for every cell without having to adjust the formula is to make use of two important things:
- The absolute reference sign ($). By placing this in front of column or row references, it "locks" down that part of the range reference, so it won't float when we move to other cells (see here for a good explanation of that: http://www.cpearson.com/excel/relative.aspx)
- The COLUMN() function, which returns the column number of whatever cell the formula is placed in. To see this, place this formula in cell A1 and copy across the row and see the value change.

The other two keys are the INT and MOD functions, which we use with division.
The INT function returns just the integer portion of a number (meaning, it drops any decimals)
The MOD function returns the remainder when dividing one number by another.
(You can Google these functions to see more details and examples of how they work, if you like).

So, now just piece it all together. If you want to see what the year portion returns, simply extract that part of the formula and place is in any blank row in column D, i.e.
Code:
=$D$1+INT(COLUMN()/4)-1
If you substitute each part, you will have:
=2018+INT(4/4)-1 = 2018+INT(1)-1 = 2018+1-1 = 2018
Because we are dividing by 4, the INT portion will jump up by one every 4th column (you can drag this formula out to column S to see how it changes).

You can repeat the same type of logic with the month (I will leave that part to you).
One other trick that I enlist, since months have different number of days, to get the last day of a particular month, you can choose day 0 of the following month, i.e.
To represent 3/31/2018, you could use:
=DATE(2018,3,31)
or
=DATE(2018,4,0)
The second is easier to work with, as you do not need to worry about with months have 30 days and which have 31.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,183
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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