CONDITIONAL FORMATTING FOR MORE THAN 3 CRITERIA?

F

FARAZ QURESHI

I have a data like a figure reflected in A1 required to be:
1. Cell colored Green if Branch Name in B1 is "BR1";
2. Text to be bold if Region in C1 is "South";
3. Cell to be bordered thick if Segment in D1 is "Auto"; and
4. Text to be colored Red if Rate in E1 is >15%;

The problem is that a case may also be belonging to BR1 in SOUTH for AUTO
with RATE >15% thus the cell being:
Colored Green with Bold and Red Text Bordered Thickly;

All means macros codes shall be highly obliged!!!

Thanx in advance!!!
 
J

J. Sperry

With Excel 2007, you can enter >3 conditional formats. For each one, use a
formula to determine which cells to format. The first one would be =B1="BR1"
and the second would be =C1="South" and so on.

However, for previous versions, here's a macro that I got from recording the
formatting, then filling in conditional statements:

Sub FunkyFormat()
Range("a1").Select
If ActiveCell.Offset(0, 1) = "BR1" Then
With Selection.Interior
.ColorIndex = 10
.Pattern = xlSolid
End With
End If
If ActiveCell.Offset(0, 2) = "South" Then Selection.Font.Bold = True
If ActiveCell.Offset(0, 3) = "Auto" Then
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
End If
If ActiveCell.Offset(0, 4) > 0.15 Then Selection.Font.ColorIndex = 3
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top