Description:
Conditional formatting is a popular feature and is a great way to easily identify cells with a range that meet some criteria. However, users often want to create conditional formatting rules that go beyond comparing a cell’s value to a single value or a single cell reference – row or column comparisons are commonly requested operations.
But sometimes the built-in formatting rules don’t go quite far enough. Adding your own formula to a conditional formatting rule gives it a power boost to help you do things the built-in rules can’t do.
Now, we’ll introduce some scenarios to help us and do it better.
Scenario 1: How to highlight the data between two special dates
Description:
In some business report, we want to highlight the important data between two special dates, we may use the conditional formatting to reach the goal quickly.
Solution:
Click Home tab>Conditional Formatting >New Rule>Use a formula to determine which cells to format > Add the formula "=AND(F$6>=$D$7,F$6<=$E$7)"
URL:
Scenario 2: How to apply conditional formatting on a range of cells in a table that is based on a data connection
Description:
When you want to format a cell based on the value of a different cell, for example to format a report row based on a single column’s value, you can use the conditional formatting feature to create a formatting formula. This post explores the details of formatting
a cell or range based on the value in another cell.
Solution:
Click Home tab>Conditional Formatting >New Rule>Use a formula to determine which cells to format > Add the formula “=$A1="X"”
URL:
http://social.technet.microsoft.com/Forums/office/en-US/46bfa2a0-a40a-4229-967d-9de419376cb9/i-need-help-generating-a-formula-in-excel-2010?forum=excel
Scenario 3:How to count the cells based on the Conditional Formatting
Sometimes, we need to count colors in cells that originate from conditional formatting.
Solution:
Method 1:
If you use formula as rule in Conditional Formatting, we may use "Countif" formula to account the result.
- DimCelAsRange
- Dim i%
- ForEachCel InSheets(1).Range("A1:A5")
- IfCel.DisplayFormat.Interior.Color="255"Then
- i= i +1
- Cel.Select
- EndIf
- NextCel
- Range("B1")= i
- End Sub
- Sub Test1()
- Dim rgeAsRange, rgeUnionAsRange, CelAsRange
- Dim i%
- Set rge=Range("A1").CurrentRegion
- ForEachCel InSheets(1).Range("A1:A5")
- IfCel.DisplayFormat.Interior.Color="255"Then
- If rgeUnionIsNothing Then
- Set rgeUnion =Cel
- Else
- Set rgeUnion =Union(rgeUnion,Cel)
- EndIf
- EndIf
- Next
- rgeUnion.Select
EndSub
Method 2:
Use macro to count the color of the cells’ background:
URL:
Summary
Conditional formatting helps you visually answer specific questions about your data. You can apply conditional formatting to a cell range, a Microsoft Excel table, or a PivotTable report. There are important differences to understand when you use conditional formatting on a PivotTable report.
Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.