Highlight Rows if more than 2 columns are entered

nehachoubey

Board Regular
Joined
Aug 17, 2011
Messages
52
Hi,
I have to highlight those rows in my excel sheet which have more than 2 columns among 3(C,D and F) entered. Plz help !!
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
It's called Conditional Formatting what you are looking for.
Another way - if you can use a spare column then enter =IF(AND(A1,C1,D1,F1)<>"",1,"") in f.e. column G then if they are not empty then you get number 1 in that column ( drag the formula down to last row )
Or... vba code ( highlights your cells only if they (A,C,D,F) are all not empty
You can very easily edit this to match your criteria 100%
Code:
Option Explicit


Sub highlight()
    Dim iter As Long
    ' if you have a header than change 1 to 2
    For iter = 1 To ActiveWorkbook.ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row
        If ActiveWorkbook.ActiveSheet.Cells(iter, "A").Value <> "" And _
            ActiveWorkbook.ActiveSheet.Cells(iter, "C").Value <> "" And _
             ActiveWorkbook.ActiveSheet.Cells(iter, "D").Value <> "" And _
              ActiveWorkbook.ActiveSheet.Cells(iter, "F").Value <> "" Then
            ActiveWorkbook.ActiveSheet.Cells(iter, "A").Interior.Color = RGB(220, 80, 20)
             ActiveWorkbook.ActiveSheet.Cells(iter, "C").Interior.Color = RGB(220, 80, 20)
              ActiveWorkbook.ActiveSheet.Cells(iter, "D").Interior.Color = RGB(220, 80, 20)
               ActiveWorkbook.ActiveSheet.Cells(iter, "F").Interior.Color = RGB(220, 80, 20)
        End If
    Next iter
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,237
Messages
6,170,924
Members
452,366
Latest member
TePunaBloke

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