By: Shamima Sultana

In reply to Chris.

Hell Chris,

Yes, it’s possible to check a text from one range and a fill color from a different range. You’d need to use VBA to compare the criteria separately. One way is to loop through each range and check if the text in one matches your condition and the fill color in the other meets your specified color.

Sub CompareTextAndColor()
Dim rngText As Range, rngColor As Range
Dim cellText As Range, cellColor As Range
Dim MatchCount As Integer
Dim ws As Worksheet

Set ws = ThisWorkbook.Sheets("Sheet1") ' Change as needed
Set rngText = ws.Range("A1:A10") ' Range with text
Set rngColor = ws.Range("B1:B10") ' Range with colors

MatchCount = 0

For Each cellText In rngText
Set cellColor = rngColor.Cells(cellText.Row - rngText.Row + 1, 1)
If cellText.Value = "YourText" And cellColor.Interior.Color = RGB(255, 0, 0) Then
MatchCount = MatchCount + 1
End If
Next cellText

MsgBox "Matches found: " & MatchCount
End Sub

Replace “YourText” and RGB(255, 0, 0) with your criteria. Let me know if you need further clarification!

Kind regards,
ExcelDemy