Excel 2021 conditional formatting that changes with the drop down menu

BrerRabbit

Board Regular
Joined
Aug 20, 2023
Messages
84
Office Version
  1. 2021
  2. 2016
  3. 2013
Platform
  1. Windows
I have an excel "database" that does various calculations, data collecting and reports for an event that occurs every year. Various reports are generated from specific columns using the indirect function.

My question, with the below example, is when I chose 2023, the company names Target and Smith & Kline are conditionally highlighted bcuz those two are dated in the Date Paid 23 column. If I chose 2024 then Harods is conditionally highlighted bcuz that one is dated in teh Date Paid 24 column. And so forth.

I honestly have no clue as to how to do this in Excel.
 

Attachments

  • Screenshot 2024-01-18 193731.png
    Screenshot 2024-01-18 193731.png
    11.7 KB · Views: 7

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Try this conditional formatting

BrerRabbit.xlsm
ABCD
1
22025
3
4
5Co NameDate paid 23Date paid 24Date paid 25
6a1/08/202326/07/2025
7b5/08/20244/08/2025
8c25/07/2023
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A6:A8Expression=FILTER(B6:D6,YEAR(B6:D6)=A$2)textNO
 
Upvote 0
Try this conditional formatting

BrerRabbit.xlsm
ABCD
1
22025
3
4
5Co NameDate paid 23Date paid 24Date paid 25
6a1/08/202326/07/2025
7b5/08/20244/08/2025
8c25/07/2023
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A6:A8Expression=FILTER(B6:D6,YEAR(B6:D6)=A$2)textNO
I have to admit, I didn't think I'd get an answer to this one. You are a legend. And it WORKED!!

Unfortunately I have forgotten to account for the columns inbetween the Date Paid Columns, and then it doesn't work. I'm a dufus and I apologise. May I ask you to apply your genius one more time?
 

Attachments

  • Screenshot 2024-01-18 201623.png
    Screenshot 2024-01-18 201623.png
    15.5 KB · Views: 6
Upvote 0
I have forgotten to account for the columns inbetween the Date Paid Column, and then it doesn't work.
By itself, having extra columns doesn't necessarily break it - see below.
Presumably there must be something in those other columns that stops it working. Can you tell/show us about that?

BrerRabbit.xlsm
ABCDEFG
1
22023
3
4
5Co NameOther columns 23Date paid 23Other Columns 24Date paid 24Other Columns 25Date paid 25
6a1/08/202326/07/2025
7b5/08/20244/08/2025
8c25/07/2023
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A6:B8Expression=FILTER(B6:G6,YEAR(B6:G6)=A$2)textNO
 
Upvote 0
By itself, having extra columns doesn't necessarily break it - see below.
Presumably there must be something in those other columns that stops it working. Can you tell/show us about that?

BrerRabbit.xlsm
ABCDEFG
1
22023
3
4
5Co NameOther columns 23Date paid 23Other Columns 24Date paid 24Other Columns 25Date paid 25
6a1/08/202326/07/2025
7b5/08/20244/08/2025
8c25/07/2023
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A6:B8Expression=FILTER(B6:G6,YEAR(B6:G6)=A$2)textNO
you're right it doesn't, unless there are dates in the other columns. I didn't see the problem properly, I do confess. This is the actual problem.
 

Attachments

  • Screenshot 2024-01-18 204347.png
    Screenshot 2024-01-18 204347.png
    16.2 KB · Views: 6
Upvote 0
unless there are dates in the other columns.
Yes, or text values. Try this one instead.

BrerRabbit.xlsm
ABCDEFG
1
22024
3
4
5Co NameOther columns 23Date paid 23Date billedDate paid 24Other Columns 25Date paid 25
6a27/04/19011/08/202327/04/19014400026/07/2025
7b8/08/20245/08/2024ggg4/08/2025
8c25/07/20238/08/2024-200
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A6:B8Expression=OR(YEAR(FILTER(B6:G6,LEFT(B$5:G$5,9)="Date paid"))=A$2)textNO
 
Upvote 0
Solution
Yes, or text values. Try this one instead.

BrerRabbit.xlsm
ABCDEFG
1
22024
3
4
5Co NameOther columns 23Date paid 23Date billedDate paid 24Other Columns 25Date paid 25
6a27/04/19011/08/202327/04/19014400026/07/2025
7b8/08/20245/08/2024ggg4/08/2025
8c25/07/20238/08/2024-200
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A6:B8Expression=OR(YEAR(FILTER(B6:G6,LEFT(B$5:G$5,9)="Date paid"))=A$2)textNO
This works. GREAT. Thank you very very much. You Sir Are A Legend.
 
Upvote 0
You are welcome. Glad to help. Thanks for the follow-up. :)
 
Upvote 0

Forum statistics

Threads
1,223,879
Messages
6,175,142
Members
452,615
Latest member
bogeys2birdies

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