+ Reply to Thread
Results 1 to 8 of 8

Condition Formatting in Pivot Table?

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    04-30-2013
    Location
    D.C.
    MS-Off Ver
    Excel 2010
    Posts
    192

    Condition Formatting in Pivot Table?

    How can I condition format cells in a pivot table with:

    If the row has a cell (A1) with 'Dog Food', then the profit percentage (D1) should be conditional formatted with those criteria:
    Green: The Sales (C1) is higher than Cost (B1) AND the profit percentage (D1) is higher than 50%.
    Yellow: The Sales (C1) is higher than Cost (B1) AND the profit percentage (D1) is lower than 50%.
    Red: The Sales (C1) is lower than Cost (B1) AND the profit percentage (D1) is lower than 50%.

    I have several different groups the above criteria would apply the same but each group has different profit percentage:
    1) Dog food (50%)
    2) Cat food (45%)
    3) Grooming (70%)
    So on...

    I have tried to think of a formula by using IF statement... AND statement... I am to no avail. -.- How may I write formulas for each criteria to condition format the profit percentage cell for each group? Keep in mind this is for a pivot table so it is likely to change and be updated. Is this possible?

    Many thanks!
    Last edited by excellenthelp; 08-04-2013 at 01:44 AM.

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2504
    Posts
    13,631

    Re: Condition Formatting in Pivot Table?

    Perhaps this link will get you started

  3. #3
    Forum Contributor rajeshturaha's Avatar
    Join Date
    08-22-2012
    Location
    Assam, India
    MS-Off Ver
    Excel 2003, 2007
    Posts
    236

    Re: Condition Formatting in Pivot Table?

    Put this formula in CF
    GREEN: if(and(c1>b1,d1>50))
    Yellow: if(and(c1>b1,d1<50))
    RED: if(and(c1<b1,d1<50))

    If not solved plz post a sample file
    Rgd
    RT
    If my answer(s) helped you, please add me reputation by click on *

  4. #4
    Forum Contributor
    Join Date
    04-30-2013
    Location
    D.C.
    MS-Off Ver
    Excel 2010
    Posts
    192

    Re: Condition Formatting in Pivot Table?

    Thanks, Pepe and raje, however, the link you gave me, Pepe, is very basic and most of us already know the basic process and raje, the code does not work.

    The Pivot Table would be updated with new data each month so I need to apply the CF each time new data is added. Also the CF formulas for Green, Yellow and Red are wrong. Grr....

    Re-posting my criterion below to remind what I am looking for exactly:
    How can I condition format cells in a pivot table with:

    If the row has a cell (A1) with 'Alimentos para Perros', then the profit percentage (D1) should be conditional formatted with those criteria:
    Green: The Sales (C1) is higher than Cost (B1) AND the profit percentage (D1) is higher than 50%.
    Yellow: The Sales (C1) is higher than Cost (B1) AND the profit percentage (D1) is lower than 50%.
    Red: The Sales (C1) is lower than Cost (B1) AND the profit percentage (D1) is lower than 50%.

    I have several different groups the above criteria would apply the same but each group has different profit percentage:
    1) Alimentos para Perros (50%)
    2) Alimentos para Gatos (45%)
    3) Pelquiera (70%)
    So on...
    I am attaching a sample file below:

    SamplePivTab.xlsx

  5. #5
    Forum Contributor rajeshturaha's Avatar
    Join Date
    08-22-2012
    Location
    Assam, India
    MS-Off Ver
    Excel 2003, 2007
    Posts
    236

    Re: Condition Formatting in Pivot Table?

    Try This

    Green: The Sales (D1) is higher than Cost (C1) AND the profit percentage (E1) is higher than 50%.
    Formula: copy to clipboard
    =AND(D14>C14,E14>INDEX($L$7:$N$24,MATCH($B14,$N$7:$N$24,0),1))

    Yellow: The Sales (D1) is higher than Cost (C1) AND the profit percentage (E1) is lower than 50%.
    Formula: copy to clipboard
    =AND(D14>C14,E14<INDEX($L$7:$N$24,MATCH($B14,$N$7:$N$24,0),2))

    Red: The Sales (D1) is lower than Cost (C1) AND the profit percentage (E1) is lower than 50%.
    Formula: copy to clipboard
    =AND(D14<C14,E14<INDEX($L$7:$N$24,MATCH($B14,$N$7:$N$24,0),2))
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    04-30-2013
    Location
    D.C.
    MS-Off Ver
    Excel 2010
    Posts
    192

    Re: Condition Formatting in Pivot Table?

    Raje,

    Whoa... Excellent Conditional Formatting formula!! However, would it continue to function when the pivot table adds more months/years? And will it still work when the fields expands/collapses?

    Thanks!

  7. #7
    Forum Contributor
    Join Date
    04-30-2013
    Location
    D.C.
    MS-Off Ver
    Excel 2010
    Posts
    192

    Re: Condition Formatting in Pivot Table?

    Raje,

    Whoa... Excellent Conditional Formatting formula!! However, would it continue to function when the pivot table adds more months/years? And will it still work when the fields expands/collapses?

    Thanks!

  8. #8
    Forum Contributor
    Join Date
    04-30-2013
    Location
    D.C.
    MS-Off Ver
    Excel 2010
    Posts
    192

    Re: Condition Formatting in Pivot Table?

    Never mind. I changed the cells for which it should apply to. I chose Apply to cells with 'Utilidad' values. It works perfectly! THANK YOU so much!! This is now marked as SOLVED.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Creating a condition on a report filter in pivot table
    By garywinder in forum Excel Charting & Pivots
    Replies: 11
    Last Post: 09-02-2012, 02:38 PM
  2. Pivot Table Border and Pivot Table Chart Formatting
    By Fish10800 in forum Excel General
    Replies: 0
    Last Post: 06-20-2012, 11:09 AM
  3. Pivot Table graph looses formatting after running formatting macro
    By arthurbr in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-27-2011, 04:16 AM
  4. Refresh Pivot table based on condition
    By booo in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-26-2010, 03:02 PM
  5. [SOLVED] Pivot Table border formatting and pivot chart formatting
    By cailotto@sbcglobal.net in forum Excel General
    Replies: 0
    Last Post: 07-22-2005, 11:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1