Conditional Format - Highlight Cell Based on Date

Kirrash

New Member
Joined
Jan 10, 2024
Messages
11
Office Version
  1. 365
Platform
  1. Windows
Sample.jpg

I would like to use conditional formatting to highlight duplicate client ID in column B - but only for the current year (column C).

I know I'm missing something and overthinking the issue. The conditional format I have tried is:
Excel Formula:
=AND($B1:$B4,">="&DATE(2024,1,1),"<="&DATE(2024,12,31),$C1:$C4>1)

I have also tried the below formula using a blank worksheet (and I did not keep the columns identical).
Sample2.jpg


Excel Formula:
=COUNTIFS($C$5:$C$10,$C5,$C$5:$C$10,"<>",$B$5:$B10,"<="&DATE(2024,1,1)>1)

Thank you.
 

Attachments

  • Sample.jpg
    Sample.jpg
    10.9 KB · Views: 1

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
How about:

varios 10oct2024.xlsm
ABC
1WorkCliDate
2Van20605/10/2024
3Mar52606/10/2024
4Ali67807/10/2024
5Sam70708/10/2024
6Ali67807/10/2023
7Sam70708/10/2024
8Mar52606/10/2024
Hoja4
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B2:B8Expression=COUNTIFS(B:B,B2,C:C,">=01/01/"&YEAR(TODAY()),C:C,"<=31/12/"&YEAR(TODAY()))>1textNO
 
Upvote 0
Hello and thank you for showing me this! Can you upload that sample file? I created a rule for the conditional format and it is not working. Thank you
Sample3.jpg
 
Upvote 0
Change Applies to:
=$B$2:$B$8

And try, with format mm/dd/
Excel Formula:
=COUNTIFS(B:B,B2,C:C,">=01/01/"&YEAR(TODAY()),C:C,"<=12/31/"&YEAR(TODAY()))>1
 
Upvote 0
That is most excellent, sir, thank you. How would you make EVERY instance highlight and not just the first one?

Sample4.jpg
 

Attachments

  • Sample4.jpg
    Sample4.jpg
    11.8 KB · Views: 2
Upvote 0
Actually, I see the formula is using B2 - how does that work? =countsifs with B:B as the range, and b2 as the criteria. The criteria should be any unique number that is duplicated. Thank you for your patience.
 
Upvote 0
How would you make EVERY instance highlight and not just the first one?

It works for all instances, if you check it out in my post #2.
Also check where you want to apply, as I put in post #4

Applies to:
=$B$2:$B$8

Cell B2 must match in applies and in the formula
1728604523772.png


Do you have other conditional formats on the sheet?

🧙‍♂️
 
Upvote 0
Solution
I see the formula is using B2 - how does that work? =countsifs with B:B as the range, and b2 as the criteria

To explain, put the following on a new sheet.
varios 10oct2024.xlsm
ABCDE
1WorkCliDateFormula
2Van20605/10/2024FALSE
3Mar52606/10/2024TRUE
4Ali67807/10/2024FALSE
5Sam70708/10/2024TRUE
6Ali67807/10/2023FALSE
7Sam70708/10/2024TRUE
8Mar52606/10/2024TRUE
Hoja5
Cell Formulas
RangeFormula
E2:E8E2=COUNTIFS(B:B,B2,C:C,">="&DATE(YEAR(TODAY()),1,1),C:C,"<="&DATE(YEAR(TODAY()),12,31))>1

In cell E2, in the formula you can see B2 (without currency symbols) is the criteria for column B.
In cell E3, in the formula you can see B3 as criteria for column B and so on.

The same thing happens in the conditional format, we only put B2 once, but in Applies, we are telling it that it is going to apply from B2 to B8, that means that the formula the criteria is B2 for B:B, for cell B3 the criteria is B3 for B:B and so on.

I hope it's helpful.
😇
 
Upvote 0
I really appreciate you explaining this to me. Saving this for future reference.

Last question. Will I have to continually update the "Applies to" and increase the range or is there a way to make it increase as rows are added?
Sample5.jpg
 
Upvote 0

Forum statistics

Threads
1,223,872
Messages
6,175,102
Members
452,613
Latest member
amorehouse

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