+ Reply to Thread
Results 1 to 8 of 8

Conditional formatting based on magnitude of change from previous value

  1. #1
    Registered User
    Join Date
    05-29-2013
    Location
    San Francisco, CA
    MS-Off Ver
    Excel 2013
    Posts
    4

    Conditional formatting based on magnitude of change from previous value

    Is there a way I can highlight cells that are differ from their adjacent cells by more than 10%?

    Sample case:
    Month 01 02 03 04 05 06 07 08 09 10 11 12
    Sales 100 112 100 130 140 160 175 200 170 170 140 135

    Here, In April, July and August, there is a sharp increase (>10%), while in September and November, there is a steep decline (>10%). I would like to format the sharp increases as Green, while sharp declines as red.

    Can I do it using conditional formatting?


    PS: I know I can attain this by creating a separate row for Month/Month growth in above example. But this example is a simplified version of my data. Real data is a lot more complex, and I need to do the formatting without creating any additional columns/rows.
    Last edited by excel.seo; 05-29-2013 at 08:02 PM.

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,705

    Re: Conditional formatting based on magnitude of change from previous value

    Yes, you can do it. First select the cells that this will apply to (I'll assume from your example that we mean from C2 to M2, as January won't have any data to compare with. Then click on Conditional Formatting | New Rule, and choose Use a Formula ... from the bottom of the list. Enter this formula:

    =(C2-B2)/B2 > 0.1

    then click on the Format button, choose the Fill tab and select Green. OK your way out - Excel will automatically adjust the cell references to suit your selected cells.

    Repeat for the declining values, but the formula will be:

    =(C2-B2)/B2 < -0.1

    and choose Red for the colour.

    Hope this helps.

    Pete

    EDIT: revised formulae with different numbers
    Last edited by Pete_UK; 05-29-2013 at 08:45 PM.

  3. #3
    Registered User
    Join Date
    05-29-2013
    Location
    San Francisco, CA
    MS-Off Ver
    Excel 2013
    Posts
    4

    Re: Conditional formatting based on magnitude of change from previous value

    Thanks Pete, but this is exactly what I tried, without luck.
    See attached screenshot:
    conditional formatting.PNG

    Am i missing something?

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Conditional formatting based on magnitude of change from previous value

    Please do not upload a picture of your file...rather, upload a sample of your workbook, showing what data you are working with, a few samples of your expected outcome is (manually entered is ok) and how you arrived at that. (exclude sensitive info)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  5. #5
    Registered User
    Join Date
    05-29-2013
    Location
    San Francisco, CA
    MS-Off Ver
    Excel 2013
    Posts
    4

    Re: Conditional formatting based on magnitude of change from previous value

    Thanks PMFDibbins.
    I have uploaded an example spreadsheet as suggested. Can somebody help me here?
    Attached Files Attached Files

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Conditional formatting based on magnitude of change from previous value

    1st, go into CF and remove the "" from those 2 rules
    2nd, change the 2nd rule to =(B3-B2)/B2 < 0.1 (it currently is =(B3-B2)/B2 > 0.1)

  7. #7
    Registered User
    Join Date
    05-29-2013
    Location
    San Francisco, CA
    MS-Off Ver
    Excel 2013
    Posts
    4

    Re: Conditional formatting based on magnitude of change from previous value

    Perfect! This works perfectly for what I need! :-)

  8. #8
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Conditional formatting based on magnitude of change from previous value

    Happy to help, but Pete did all the work

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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