If Cells(i, 8) = "Cancelled Not Applicable" Or Cells(i, 8) = "Completed" Or Cells(i, 8) <> "" Then
If Cells(i, 23) <> "Cancelled" Or Cells(i, 23) <> "Completed" Then
Cells(i, 23).Interior.ColorIndex = 4
End If
End If
This says:
If Your case status is "Cancelled Not Applicable" or you case status is "Completed" or your case status is any value (not empty) then go ahead and test if your program status is any value (as it can't be both "Cancelled" AND "Completed" at the same time) then go ahead and highlight it.
So really there are two issues here.
Your Or Cells(i, 8).value <> "" Here you are saying "Pass this IF line as true if this cell is blank" because it's an OR. It's like saying "If this chicken is red or this chicken is black or this chicken exists" So if you are testing a blue chicken it will pass as it exists.
Your Cells(i, 23) <> "Cancelled" Or Cells(i, 23) <> "Completed". If the cell contains "Cancelled" then your second condition is true since it doesn't say "Completed" so this passes. If your cell says "Completed" then your first condition passes as it's not "Cancelled". If your cell says "Booger farts" then both conditions pass as it's not "Cancelled" nor is it "Completed". So really you want AND here.
That second point is difficult to grasp since "OR" isn't how we would use it english. It may help to think of it this way: If we have a test like IF condition1 OR condition2 OR condition3 then only one of those conditions needs to be true for this to pass. If TRUE OR FALSE OR FALSE passes. Your conditions here are "Not equal to" which adds to the confusion, but you merely have to concentrate on the individual condition and determine if it returns "TRUE" or "FALSE" and make your statement IF TRUE OR FALSE (passes) or IF TRUE OR TRUE (passes) or IF FALSE OR TRUE(passes) or IF FALSE OR FALSE (finally it fails!).
Instead you wish to say:
If the CASE STATUS is filled in and if the PROGRAM STATUS is IN PROGRESS or PENDING or PENDING REVIEW, etc. then the CASE STATUS cannot be CANCELLED OR COMPLETED
So:
If Cells(i,8).value <> "" AND (Cells(i, 8).value = "Cancelled Not Applicable" OR Cells(i,8).value = "Completed") AND (Cells(i, 23).Value <> "Cancelled" AND Cells(i, 23).Value <> "Completed") Then
Cells(i, 23).Interior.ColorIndex = 4
End If
andinstead of anorcan you post an image of your workbook , maybe? This could be data related but is hard to tell.Or Cells(i, 8) <> ""will enter the first condition given any non-empty cell.Cells(i, 8) <> "", that's making the first two criteria for"Cancelled Not Applicable" Or "Completed"completely irrelevant, because it's saying "if a cell is not blank, then do something"