Solved

Compare Pivot Table Columns with Conditional Formatting.

Posted on 2011-03-10
5
325 Views
Last Modified: 2012-06-27
I've got a Pivot Table set up the reviews a set of Projects. I want to highlight a value that is larger than the value in the next column. I know I could just do a formula or an IF statement and hide that, but I want to have something clean and easy.

Here's a screenshot of part of my Pivot Table:
 PrjPivotExampleWhat I want to do is Highlight the value in the "Total at Billing" column if it is larger than the value in the "Rev Budget" column.

In this example Row 12 should be highlighted.

0
Comment
Question by:thomas-sherrouse
  • 3
  • 2
5 Comments
 
LVL 6

Accepted Solution

by:
royhsiao earned 500 total points
ID: 35098242
try this
Sub test()
Dim i As Integer
Dim j As Integer

i = Range("T65536").End(xlUp).Row
For j = 1 To i
If Cells(j, 20) > Cells(j, 21) And IsNumeric(Cells(j, 20)) = True Then
    Cells(j, 20).Select
    With Selection.Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .Color = 65535
        .TintAndShade = 0
        .PatternTintAndShade = 0
    End With
Else
End If
Next j
End Sub

Open in new window

0
 

Author Comment

by:thomas-sherrouse
ID: 35098564
Is there any way to do it without a Macro?
0
 
LVL 6

Expert Comment

by:royhsiao
ID: 35101780
you could use conditional formatting but it will take a while.
0
 

Author Comment

by:thomas-sherrouse
ID: 35108324
I've already got Conitional Formatting set up to highlight negative numbers, but instead of Highlight if less than $0 I want to highlight if less than the cell value to the left of the current number. This is a report that will be updated so I don't want any static or frozen references.
0
 
LVL 6

Expert Comment

by:royhsiao
ID: 35108938
You could try to call the macro when the selection has change or pivot table update
Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)
Call test
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Call test
End Sub

Open in new window

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question