Conditional formatting based on 2 duplicate values and dates

cpisthedbb

New Member
Joined
Apr 10, 2018
Messages
30
Hi,

I've got a conditional formatting problem which I'm unable to solve. I have a range of dates in a column as can be seen below. All in one column is the date and whether that date was the night or day. I'm looking on highlighting the dates with conditional formatting if the dates match the previous ignoring if it's day or night. IE I want to highlight the 12/04, 26/04 and 30/04. Is there a way this can be done?

10/04 Night
09/04 Night
13/04 Night
12/04 Day
12/04 Night
16/04 Night
13/04 Night
13/04 Day
30/04 Night
26/04 Day
26/04 Night
27/04 Day
23/04 Day
30/04 Day
30/04 Night
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Assuming the data are in cells A1:A15, one way is to add the following conditional formatting formula (with appropriate formatting style) to cells A2:A15:
Code:
=MID(A2,1,5)=MID(A1,1,5)

It will show the formatting in all but the top cell of same-date cells. For example, in your data, it would highlight the lower cell of the dates you mentioned.

If you want to also highlight the top cell, add a second formula for cells A1:A14:
Code:
=MID(A1,1,5)=MID(A2,1,5)
 
Upvote 0
Assuming the data are in cells A1:A15, one way is to add the following conditional formatting formula (with appropriate formatting style) to cells A2:A15:
Code:
=MID(A2,1,5)=MID(A1,1,5)

It will show the formatting in all but the top cell of same-date cells. For example, in your data, it would highlight the lower cell of the dates you mentioned.

If you want to also highlight the top cell, add a second formula for cells A1:A14:
Code:
=MID(A1,1,5)=MID(A2,1,5)


That's brilliant, worked a treat. Thanks for you help.
 
Upvote 0
If your data has a heading row you could do it with this single rule.

Excel Workbook
A
1Data
210/04 Night
309/04 Night
413/04 Night
512/04 Day
612/04 Night
716/04 Night
813/04 Night
913/04 Day
1030/04 Night
1126/04 Day
1226/04 Night
1327/04 Day
1423/04 Day
1530/04 Day
1630/04 Night
CF Same Date
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A21. / Formula is =FIND(LEFT(A2,5),A1&A3)Abc
 
Upvote 0

Forum statistics

Threads
1,216,075
Messages
6,128,657
Members
449,462
Latest member
Chislobog

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