Using conditional formatting to auto colour cells

Goddess

Board Regular
Joined
Dec 3, 2015
Messages
94
Office Version
  1. 2019
Platform
  1. Windows
Hi all!,

I have a calendar which I need to keep track of project timeline, which changes every month or so. Is there a way to auto colour the corresponding cells based on the date given?

Book1
ABCDEFGHIJKLMNOP
1
2FruitsDateJan-22Feb-22Mar-22
331017243171421287142128
4Apple5/1/2022
5Grape6/1/2022
6Apple/Grape8/2/2022
7Apple/Grape/Orange18/3/2022
8Apple20/3/2022
9Apple28/3/2022
10Grape29/3/2022
11
Sheet1


For example, when I enter the date in column C, cells in column D till P will change colour based on the date range (the date on each month begins on a Monday), and the colour will also depends on what is written in column B (anything with Apple is represented by yellow colour, whereas other text will be represented by grey colour).

So for cell C4, the correct cell to highlight is D4, since 3 is the range for 3rd - 9th of January 2022.

Thanks!
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Hi,

This should work, but you need to populate D2:P2 with Date in every cell (e.g. 1/1/2022 for D2:H2, 2/1/22 for I2:L2, etc.)

Book3.xlsx
ABCDEFGHIJKLMNOP
1
2FruitsDateJan-22Jan-22Jan-22Jan-22Jan-22Feb-22Feb-22Feb-22Feb-22Mar-22Mar-22Mar-22Mar-22
331017243171421287142128
4Apple1/5/2022
5Grape1/6/2022
6Apple/Grape2/8/2022
7Apple/Grape/Orange3/18/2022
8Apple3/20/2022
9Apple3/28/2022
10Grape3/29/2022
Sheet949
Cells with Conditional Formatting
CellConditionCell FormatStop If True
D4:P10Expression=AND(WEEKNUM($C4,2)=WEEKNUM(DATE(YEAR(D$2),MONTH(D$2),D$3),2),COUNTIF($B4,"*Apple*")=0)textNO
D4:P10Expression=AND(WEEKNUM($C4,2)=WEEKNUM(DATE(YEAR(D$2),MONTH(D$2),D$3),2),COUNTIF($B4,"*Apple*"))textNO
 
Upvote 0
If you want to Keep your current format, an alternative to my suggestion above, would be to put Actual Dates in D3:P3, format D3:P3 custom "d" (without quotes):

Book3.xlsx
ABCDEFGHIJKLMNOP
1
2FruitsDateJan-22Feb-22Mar-22
331017243171421287142128
4Apple1/5/2022
5Grape1/6/2022
6Apple/Grape2/8/2022
7Apple/Grape/Orange3/18/2022
8Apple3/20/2022
9Apple3/28/2022
10Grape3/29/2022
Sheet949 (2)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
D4:P10Expression=AND(WEEKNUM($C4,2)=WEEKNUM(D$3,2),COUNTIF($B4,"*Apple*")=0)textNO
D4:P10Expression=AND(WEEKNUM($C4,2)=WEEKNUM(D$3,2),COUNTIF($B4,"*Apple*"))textNO
 
Upvote 0
Sticking with you original layout, I think this adaptation of @jtakw's suggestion should also work.

22 01 22.xlsm
ABCDEFGHIJKLMNOP
1
2FruitsDateJan-22Feb-22Mar-22
331017243171421287142128
4Apple5/01/2022
5Grape6/01/2022
6Apple/Grape8/02/2022
7Apple/Grape/Orange18/03/2022
8Apple20/03/2022
9Apple28/03/2022
10Grape29/03/2022
Timeline
Cells with Conditional Formatting
CellConditionCell FormatStop If True
D4:P10Expression=AND($C4-(LOOKUP(99999,$D$2:D$2)+D$3-1)>=0,$C4-(LOOKUP(99999,$D$2:D$2)+D$3-1)<7,COUNTIF($B4,"*apple*")=0)textNO
D4:P10Expression=AND($C4-(LOOKUP(99999,$D$2:D$2)+D$3-1)>=0,$C4-(LOOKUP(99999,$D$2:D$2)+D$3-1)<7,COUNTIF($B4,"*apple*"))textNO
 
Upvote 0
Thank you both so much! Made my life so much easier without having to manually change the colours every time the date changes!! :D :D :D
 
Upvote 0
You're welcome. Glad we could help. Thanks for the follow-up. :)
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,561
Members
449,089
Latest member
Motoracer88

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