Using Countif with Conditional Formatting

SingTuba

New Member
Joined
Nov 23, 2022
Messages
3
Office Version
  1. 2016
Platform
  1. Windows
Hello, I am trying to make a sheet that highlights if there are clash between Exam schedules. I can use Countif to check if there are more than one exact slots in a row and highlight the exact cells with Conditional Formatting.
But when I use countif to check overlapping time slots the formula works but Conditional Formatting highlights the entire row. Is it possible for Conditional Formatting to work with my Overlapping Countif formula?.

Book1.xlsx
ABCDEFGHIJ
1
2StudentsExam and TimeOverlap between two exact Slots Overlap between Monday Slot 1 and Monday Slot 1.5Overlap between Tuesday Slot 1 and Tuesday Slot 1.5Legend
3AmeliaEnglishMathsArtHistorySlot 1 = 10:00 AM -11:30 AM
4Time SlotMonday Slot 1Tuesday Slot 1Monday Slot 1Tuesday Slot 2TRUEFALSEFALSESlot 1.5 = 10:00 AM - 12:00 PM
5Jayden LiteratureMathsMusicGeographySlot 2 = 11:30 AM-1:00 PM
6Time SlotMonday Slot 1Tuesday Slot 1Monday Slot 1.5Tuesday Slot 2FALSETRUEFALSESlot 2.5 = 12:00 PM -1:30 PM
Sheet1
Cell Formulas
RangeFormula
F4F4=COUNTIF($B$4:$E$4,B4)>1
G4G4=AND(COUNTIF($B$4:$E$4,"Monday Slot 1"),COUNTIF($B$4:$E$4,"Monday Slot 1.5"))
H4H4=AND(COUNTIF($B$4:$E$4,"Tuesday Slot 1"),COUNTIF($B$4:$E$4,"Tuesday Slot 1.5"))
F6F6=COUNTIF($B$6:$E$6,B6)>1
G6G6=AND(COUNTIF($B$6:$E$6,"Monday Slot 1"),COUNTIF($B$6:$E$6,"Monday Slot 1.5"))
H6H6=AND(COUNTIF($B$6:$E$6,"Tuesday Slot 1"),COUNTIF($B$6:$E$6,"Tuesday Slot 1.5"))
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B6:E6Expression=COUNTIF($B$6:$E$6,"Monday Slot 1")+COUNTIF($B$6:$E$6,"Monday Slot 1.5")>1textNO
B4:E4Expression=COUNTIF($B$4:$E$4,B4)>1textNO
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
How about
Excel Formula:
=COUNTIF($B$6:$E$6,B6)>1
 
Upvote 0
How about
Excel Formula:
=COUNTIF($B$6:$E$6,B6)>1
Hi, yes this formula works for two exact values but I need Conditional Formatting to highlight cells that have text in the Countif formula criteria.
Excel Formula:
=COUNTIF($B$6:$E$6,"Monday Slot 1")+COUNTIF($B$6:$E$6,"Monday Slot 1.5")>1
 
Upvote 0
How about
Excel Formula:
=AND(OR(B6="Monday Slot 1",B6="Monday Slot 1.5"),COUNTIF($B$6:$E$6,"Monday Slot 1"),COUNTIF($B$6:$E$6,"Monday Slot 1.5"))
 
Upvote 0
Solution
How about
Excel Formula:
=AND(OR(B6="Monday Slot 1",B6="Monday Slot 1.5"),COUNTIF($B$6:$E$6,"Monday Slot 1"),COUNTIF($B$6:$E$6,"Monday Slot 1.5"))
Wow this works perfectly, Thank You so much.
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,827
Messages
6,181,197
Members
453,021
Latest member
pingpong7117

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