Forum Discussion
Conditional formatting with date comparison
Select the entire range that you want to format conditionally. I will assume that K9 is the active cell in the selection.
On the Home tab of the ribbon, click Conditional Formatting > New Rule...
Select 'Use a formula to determine which cells to format'.
Enter the formula
=COUNTIF($E$9:$E$44,K$5)
If the dates in column E extend further down than row 44, adjust the formula correspondingly.
Click Format...
Activate the Borders tab.
Specify red left and right borders.
Click OK, then click OK again.
HansVogelaar Thank you for your reply. Unfortunately, it did not work for what I'm trying to accomplish, but it also didn't "break" what was already working.
If there is a date in any cell in column E, I want it to format the corresponding date column. The date columns are K through RR (currently). I tried using your formula but adjusting to =COUNTIF($E$9:$E$44,K$5:$RR$5) but that didn't work either. (Disregard the green highlight, that is a separate formula showing "today".)
- HansVogelaarApr 22, 2022MVP
Could you attach a sample workbook without sensitive data, or if that is not possible, could you make it available through one of the websites that let you upload and share a file, such as OneDrive, Google Drive, FileDropper or DropBox. Then post a link to the uploaded and shared file here.
- adsummersApr 22, 2022Copper Contributorhttps://docs.google.com/spreadsheets/d/1kTTMyIY2RnTClnDpVaoH25GerVK2bEqi/edit?usp=sharing&ouid=104055744807510321274&rtpof=true&sd=true
I'm new to this platform so hopefully I've done this right.- HansVogelaarApr 22, 2022MVP
Thanks. The rule should use formula
=COUNTIF($E$9:$E$50,K$5)
Exactly like I proposed, except that it uses 50 instead of 49.
And it should apply to $K$5:$RR$50, not just to $K$5:$K$50.
See the attached version, in which I entered a few dates in column D.