Conditonal format pivot table based on comparing two values

Seabee1

New Member
Joined
Feb 19, 2018
Messages
7
hello, working on a pivot table conditional formatting and need help.
I want to compare each month AVG CPH to previous month and if greater format green and less format red.
for example in February NTX cph was higher than January so that would be green and WTX in February is lower than January so that should be red. any help for this would be appreciated. thank you.
[TABLE="width: 988"]
<colgroup><col width="92" style="width: 69pt; mso-width-source: userset; mso-width-alt: 3364;"> <col width="136" style="width: 102pt; mso-width-source: userset; mso-width-alt: 4973;" span="8"> <col width="137" style="width: 103pt; mso-width-source: userset; mso-width-alt: 5010;"> <tbody>[TR]
[TD="width: 92, bgcolor: transparent"][/TD]
[TD="width: 136, bgcolor: transparent"][/TD]
[TD="width: 136, bgcolor: transparent"][/TD]
[TD="width: 136, bgcolor: transparent"][/TD]
[TD="width: 136, bgcolor: transparent"][/TD]
[TD="width: 136, bgcolor: transparent"][/TD]
[TD="width: 136, bgcolor: transparent"][/TD]
[TD="width: 136, bgcolor: transparent"][/TD]
[TD="width: 136, bgcolor: transparent"][/TD]
[TD="width: 137, bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="class: xl68"] [/TD]
[TD="class: xl77"]MONTH [/TD]
[TD="class: xl75"]Values[/TD]
[TD="class: xl75"] [/TD]
[TD="class: xl76"] [/TD]
[TD="class: xl77"] [/TD]
[TD="class: xl76"] [/TD]
[TD="class: xl75"] [/TD]
[TD="class: xl76"] [/TD]
[TD="class: xl77"] [/TD]
[/TR]
[TR]
[TD="class: xl69"] [/TD]
[TD]January[/TD]
[TD]January[/TD]
[TD]February[/TD]
[TD]February[/TD]
[TD]March[/TD]
[TD]March[/TD]
[TD]April[/TD]
[TD]April[/TD]
[TD]Total AVG Efficiency[/TD]
[/TR]
[TR]
[TD="class: xl74, width: 92"]MU[/TD]
[TD="class: xl65"]AVG Efficiency[/TD]
[TD="class: xl66"]AVG CPH[/TD]
[TD="class: xl65"]AVG Efficiency[/TD]
[TD="class: xl66"]AVG CPH[/TD]
[TD="class: xl65"]AVG Efficiency[/TD]
[TD="class: xl66"]AVG CPH[/TD]
[TD="class: xl65"]AVG Efficiency[/TD]
[TD="class: xl66"]AVG CPH[/TD]
[TD="class: xl82"] [/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent"]NTX[/TD]
[TD="class: xl73, bgcolor: transparent, align: right"]114.45%[/TD]
[TD="class: xl78, bgcolor: transparent, align: right"]190.22[/TD]
[TD="class: xl72, bgcolor: transparent, align: right"]124.20%[/TD]
[TD="class: xl78, bgcolor: transparent, align: right"]328.70[/TD]
[TD="class: xl72, bgcolor: transparent, align: right"]121.41%[/TD]
[TD="class: xl78, bgcolor: transparent, align: right"]207.40[/TD]
[TD="class: xl72, bgcolor: transparent, align: right"]115.20%[/TD]
[TD="class: xl78, bgcolor: transparent, align: right"]192.59[/TD]
[TD="class: xl72, bgcolor: transparent, align: right"]118.86%[/TD]
[/TR]
[TR]
[TD="class: xl69, bgcolor: transparent"]OKMU[/TD]
[TD="class: xl67, bgcolor: transparent"] [/TD]
[TD="class: xl70, bgcolor: transparent"][/TD]
[TD="class: xl71, bgcolor: transparent"][/TD]
[TD="class: xl70, bgcolor: transparent"][/TD]
[TD="class: xl71, bgcolor: transparent"][/TD]
[TD="class: xl70, bgcolor: transparent"][/TD]
[TD="class: xl71, bgcolor: transparent, align: right"]58.44%[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]91.29[/TD]
[TD="class: xl71, bgcolor: transparent, align: right"]58.44%[/TD]
[/TR]
[TR]
[TD="class: xl69, bgcolor: transparent"]SCTX[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]104.55%[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]164.50[/TD]
[TD="class: xl71, bgcolor: transparent, align: right"]104.87%[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]165.23[/TD]
[TD="class: xl71, bgcolor: transparent, align: right"]105.13%[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]194.94[/TD]
[TD="class: xl71, bgcolor: transparent, align: right"]102.55%[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]161.38[/TD]
[TD="class: xl71, bgcolor: transparent, align: right"]104.30%[/TD]
[/TR]
[TR]
[TD="class: xl69, bgcolor: transparent"]SETX[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]160.28%[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]258.37[/TD]
[TD="class: xl71, bgcolor: transparent, align: right"]154.81%[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]275.32[/TD]
[TD="class: xl71, bgcolor: transparent, align: right"]100.10%[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]170.19[/TD]
[TD="class: xl71, bgcolor: transparent, align: right"]175.05%[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]276.24[/TD]
[TD="class: xl71, bgcolor: transparent, align: right"]146.93%[/TD]
[/TR]
[TR]
[TD="class: xl69, bgcolor: transparent"]WTX[/TD]
[TD="class: xl67, bgcolor: transparent, align: right"]101.08%[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]163.76[/TD]
[TD="class: xl71, bgcolor: transparent, align: right"]100.71%[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]163.14[/TD]
[TD="class: xl71, bgcolor: transparent, align: right"]97.48%[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]161.27[/TD]
[TD="class: xl71, bgcolor: transparent, align: right"]90.49%[/TD]
[TD="class: xl70, bgcolor: transparent, align: right"]147.68[/TD]
[TD="class: xl71, bgcolor: transparent, align: right"]97.49%[/TD]
[/TR]
[TR]
[TD="class: xl65"]Grand Total[/TD]
[TD="class: xl79, align: right"]125.21%[/TD]
[TD="class: xl80, align: right"]202.30[/TD]
[TD="class: xl81, align: right"]126.16%[/TD]
[TD="class: xl80, align: right"]241.89[/TD]
[TD="class: xl81, align: right"]105.94%[/TD]
[TD="class: xl80, align: right"]183.58[/TD]
[TD="class: xl81, align: right"]123.78%[/TD]
[TD="class: xl80, align: right"]198.16[/TD]
[TD="class: xl81, align: right"]120.08%[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
[Table="width:, class:head"][tr=bgcolor:#E0E0F0][th] [/th][th]
A
[/th][th]
B
[/th][th]
C
[/th][th]
D
[/th][th]
E
[/th][th]
F
[/th][th]
G
[/th][th]
H
[/th][th]
I
[/th][th]
J
[/th][th]
K
[/th][/tr]
[tr=bgcolor:#FFFFFF][td=bgcolor:#E0E0F0]
1
[/td][td]MONTH[/td][td]Values[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]


[tr=bgcolor:#FFFFFF][td=bgcolor:#E0E0F0]
2
[/td][td][/td][td]January[/td][td]January[/td][td]February[/td][td]February[/td][td]March[/td][td]March[/td][td]April[/td][td]April[/td][td]Total AVG Efficiency[/td][td][/td][/tr]


[tr=bgcolor:#FFFFFF][td=bgcolor:#E0E0F0]
3
[/td][td]MU[/td][td]AVG Efficiency[/td][td]AVG CPH[/td][td]AVG Efficiency[/td][td]AVG CPH[/td][td]AVG Efficiency[/td][td]AVG CPH[/td][td]AVG Efficiency[/td][td]AVG CPH[/td][td][/td][td][/td][/tr]


[tr=bgcolor:#FFFFFF][td=bgcolor:#E0E0F0]
4
[/td][td]NTX[/td][td]
114.45%​
[/td][td]
190.22​
[/td][td=bgcolor:#92D050]
124.20%​
[/td][td=bgcolor:#92D050]
328.7​
[/td][td=bgcolor:#FF0000]
121.41%​
[/td][td=bgcolor:#FF0000]
207.4​
[/td][td=bgcolor:#FF0000]
115.20%​
[/td][td=bgcolor:#FF0000]
192.59​
[/td][td]
118.86%​
[/td][td][/td][/tr]


[tr=bgcolor:#FFFFFF][td=bgcolor:#E0E0F0]
5
[/td][td]OKMU[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td=bgcolor:#92D050]
58.44%​
[/td][td=bgcolor:#92D050]
91.29​
[/td][td]
58.44%​
[/td][td][/td][/tr]


[tr=bgcolor:#FFFFFF][td=bgcolor:#E0E0F0]
6
[/td][td]SCTX[/td][td]
104.55%​
[/td][td]
164.5​
[/td][td=bgcolor:#92D050]
104.87%​
[/td][td=bgcolor:#92D050]
165.23​
[/td][td=bgcolor:#92D050]
105.13%​
[/td][td=bgcolor:#92D050]
194.94​
[/td][td=bgcolor:#FF0000]
102.55%​
[/td][td=bgcolor:#FF0000]
161.38​
[/td][td]
104.30%​
[/td][td][/td][/tr]


[tr=bgcolor:#FFFFFF][td=bgcolor:#E0E0F0]
7
[/td][td]SETX[/td][td]
160.28%​
[/td][td]
258.37​
[/td][td=bgcolor:#FF0000]
154.81%​
[/td][td=bgcolor:#92D050]
275.32​
[/td][td=bgcolor:#FF0000]
100.10%​
[/td][td=bgcolor:#FF0000]
170.19​
[/td][td=bgcolor:#92D050]
175.05%​
[/td][td=bgcolor:#92D050]
276.24​
[/td][td]
146.93%​
[/td][td][/td][/tr]


[tr=bgcolor:#FFFFFF][td=bgcolor:#E0E0F0]
8
[/td][td]WTX[/td][td]
101.08%​
[/td][td]
163.76​
[/td][td=bgcolor:#FF0000]
100.71%​
[/td][td=bgcolor:#FF0000]
163.14​
[/td][td=bgcolor:#FF0000]
97.48%​
[/td][td=bgcolor:#FF0000]
161.27​
[/td][td=bgcolor:#FF0000]
90.49%​
[/td][td=bgcolor:#FF0000]
147.68​
[/td][td]
97.49%​
[/td][td][/td][/tr]


[tr=bgcolor:#FFFFFF][td=bgcolor:#E0E0F0]
9
[/td][td]Grand Total[/td][td]
125.21%​
[/td][td]
202.3​
[/td][td=bgcolor:#92D050]
126.16%​
[/td][td=bgcolor:#92D050]
241.89​
[/td][td=bgcolor:#FF0000]
105.94%​
[/td][td=bgcolor:#FF0000]
183.58​
[/td][td=bgcolor:#92D050]
123.78%​
[/td][td=bgcolor:#92D050]
198.16​
[/td][td]
120.08%​
[/td][td][/td][/tr]


[tr=bgcolor:#FFFFFF][td=bgcolor:#E0E0F0]
10
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]
[/table]
[Table="width:, class:grid"][tr][td]Sheet: Sheet25[/td][/tr][/table]


Green conditional formatting formula applied to cell range D4:I9:
=B4<d4[ code]<d4
less than sign D4
Red conditional formatting formula applied to cell range D4:I9:
=B4>D4 </d4[>
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,814
Messages
6,181,127
Members
453,021
Latest member
Justyna P

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