Range A is B1:E2000 (really, it should be B1:B500, C1:C1000, D1:D1500, E1:E2000).
Range B is G1:G2000.
Range C is I1:AH2000.
Step 1: If a cell appears in Range A and Range C, I want them highlighted yellow.
Step 2: Then, if a cell appears in Range A and Range B, I want them highlighted green. It is intended that this may highlight over cells already highlighted yellow by Step 1.
Step 3: Then, if a cell appears in Range B and more than twice in Range C, I want them highlighted red. It is intended that this may highlight over cells already highlighted yellow by Step 1 or highlighted green by Step 2.
Step 4: Otherwise, a cell should not be highlighted. If a highlighted cell has text that is later deleted, then, when I run the macro again, I would want the empty cell to be un-highlighted.
I do not care about duplicates within the ranges themselves.
I can almost figure this out in Conditional Formatting, but CF is "volatile", and I want avoid lag every time I try to scroll (though, that's also in part due to my CF being horribly inefficient), so I'm more than happy to use a VBA macro to run it when I need it. (Of course, if there is a better way to do it with Conditional Formatting, I'm not going to say no.)
If you really want to see my awful and hacky attempt at cobbling together code I found for similar results, so be it:
Sub HighlightDuplicates()
Dim cells As Range
Dim cell As Range
Set cells = Range("B1:AH2000")
For Each cell In cells
If WorksheetFunction.CountIf(cells, cell.Value) > 3 Then
cell.Interior.ColorIndex = 3
ElseIf WorksheetFunction.CountIf(cells, cell.Value) > 2 Then
cell.Interior.ColorIndex = 4
ElseIf WorksheetFunction.CountIf(cells, cell.Value) > 1 Then
cell.Interior.ColorIndex = 6
Else
cell.Interior.ColorIndex = 0
End If
Next cell
End Sub
It's clear that I don't have a strong idea of what I'm doing, and I could not for the life of me figure out how to work across multiple ranges. It obviously doesn't function as intended either. Furthermore, this is checking every cell against every cell, which is obviously horribly inefficient for what I'm trying to do.
I know very little about macros (though, I used to dabble back in high school), and it seems I'm way out of my depth.
I know that I'm asking for fish and not for you to teach me how to fish. I'm working on starting from the basics, but it has been slow-going, and I feel miles away from being able to properly accomplish what I want right now.