Hospital shift managing help needed-How to highlight duplicate cells in consecutive rows

alkimbeyhan

New Member
Joined
Dec 31, 2016
Messages
2
Hi, I'm trying to create our shift calendar at the hospital I'm working in and I have a problem
I'm trying to use conditional formatting to highlight duplicate cells in 3 row range.

For example;
ABCD
01/01/17JOHNKATEALICE
02/01/17REEDPETERDONALD
03/01/17RICHARDJOHNCLEMENTINE

<tbody>
</tbody>

I want B1 and C3 highlighted, because "JOHN" is repeated twice in a three day span, even though they are not necessarily in the same column
I want to know if there is a formula that can be used for this purpose
Cheers
 

Excel Facts

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

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,210
On 2016 you have the option Highlight Cells Rules | Duplicate Values.

Otherwise, select A2:D4 and invoke the following formula:

=COUNTIFS($A$2:$D$4,A2)>1

then format as desired.
 

alkimbeyhan

New Member
Joined
Dec 31, 2016
Messages
2
Hmm...this formula seems to highlight the next cell in the next column and it highlights all the duplicates in the given range.what i want is for it to just highlight cells if they are repeated twice in three days,not if they are just duplicates. so people don't have shifts every other day and they get a chance to rest with a free day in between.
 

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,210
Hmm...this formula seems to highlight the next cell in the next column and it highlights all the duplicates in the given range.what i want is for it to just highlight cells if they are repeated twice in three days,not if they are just duplicates. so people don't have shifts every other day and they get a chance to rest with a free day in between.

In E2 control+shift+enter, not just enter, and copy down:

=IF(ISNUMBER(MATCH(3,ABS($A$2:$A$4-$A2)+1,0)),1,0)

In CF invoke:

=AND(COUNTIFS($A$2:$D$4,B2)>1,$E2=1)
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,865
Messages
5,834,066
Members
430,260
Latest member
MANICX100

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
Top