简体   繁体   中英

Color excel pivot columns based by column header

I would like to change background colors on the columns in my pivot table based on the header (dimension on the X-axis).

When i click "Banded colums" it just colors every secon column, but i want the behavior from the last table in my example below. It should change every time the year is changing.

In the example the columns are always grouped in pairs two and two, but a solution that can handle variable column-sets would be perfect.

Any suggestions?

Example

I'd suggest to use a conditional format. Home, Conditional formatting. Suppose you want to highlight all columns which have "#Rolls":

  • Select all data columns in the PT, for example cells B4:I20
  • Click Home, Conditional formatting, New Rule
  • Select "Use a formula to determine which cells to format"
  • Enter this formula: =B$4="#Rolls"
  • Choose the appropriate format by clicking the format button and setting things up.
  • OK your way back to Excel

Now I understand, I totally misread your question.

  • Right-click one of the pivottable styles you like and select "Duplicate".
  • Give the style a meaningful name
  • Click the First Column stripe item
  • Set Stripe size to 2
  • Click the Second Column stripe item
  • Set Stripe size to 2
  • OK
  • Click the PivotTable Styles dropdown and select your newly added style.
  • Check "Banded columns"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM