+ Reply to Thread
Results 1 to 14 of 14

Conditional formatting based on sum of adjacent cells values and specific data

  1. #1
    Registered User
    Join Date
    09-05-2017
    Location
    London
    MS-Off Ver
    2013
    Posts
    17

    Conditional formatting based on sum of adjacent cells values and specific data

    I have a table where the values are quantities of ingredients that need to be used up, prioritized by conditional format depending on the dates values (first row dates). However i need the formula to take into consideration the maximum amount of each ingredient required (last column data), so only highlight the amounts than are required.

    The formula i have is working but
    a) It does not work if the sum exceeds what is required. This is what I’m trying to add: OR(SUM($C$2:D2)<=$P2, P2>SUM($C2:C2)) but not sure how.

    b) Struggling to get it applied properly to multiple rows and columns.



    Example attached.
    Attached Files Attached Files
    Last edited by joey1; 11-10-2017 at 04:55 PM.

  2. #2
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Conditional formatting based on sum of adjacent cells values and specific d

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need.

    Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  3. #3
    Registered User
    Join Date
    09-05-2017
    Location
    London
    MS-Off Ver
    2013
    Posts
    17

    Re: Conditional formatting based on sum of adjacent cells values and specific data

    Manage to solve it using simply SUM($B2:B2)<$P2 , whereby each new cell sums all previous cells and ensure they below the maxium allowed value and if they are, then the cell changes colour.

    The only minor problem i have is the starting reference cells in B column have product codes in them and are not relevant to the formula. Is there any solution other than inserting a blank column.
    Last edited by joey1; 11-11-2017 at 06:21 AM.

  4. #4
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Conditional formatting based on sum of adjacent cells values and specific data

    In the sample that you attached, column P is blank. Did you mean column O?

    Also, please update your sample with the desired result (bold part from post #2) showing.

  5. #5
    Registered User
    Join Date
    09-05-2017
    Location
    London
    MS-Off Ver
    2013
    Posts
    17

    Re: Conditional formatting based on sum of adjacent cells values and specific data

    sorry, yes in the example its column Q. I was looking at my own sheet.

    Have attached updated sheet, everything working fine. Have the blank C column inserted, if no other option, will have to go with that.
    Attached Files Attached Files
    Last edited by joey1; 11-11-2017 at 05:16 PM.

  6. #6
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Conditional formatting based on sum of adjacent cells values and specific data

    Try this (after deleting that empty column so that your data goes from A1:O6):

    Highlight C2:J6 > Conditional Formatting > New Rule > Use a formula

    =AND(OR(COLUMNS($A$1:A$1)=1,SUM($B2:B2)<$O2),C$1 < TODAY())
    Format: Fill red > OK > OK

    =AND(OR(COLUMNS($A$1:A$1)=1,SUM($B2:B2)<$O2),C$1 = TODAY())
    Format: Fill yellow > OK > OK

    =AND(OR(COLUMNS($A$1:A$1)=1,SUM($B2:B2)<$O2),C$1 > TODAY())
    Format: Fill green > OK > OK

    It doesn't matter that the sum range is starting with column B since the SUM function only looks at numbers.

  7. #7
    Registered User
    Join Date
    09-05-2017
    Location
    London
    MS-Off Ver
    2013
    Posts
    17

    Re: Conditional formatting based on sum of adjacent cells values and specific data

    That works but it ignores if any of the cells are blank other than column O.

    I need to have AND(C2>0,OR($O2<>"", $N2<>"") in the formula.

  8. #8
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,548

    Re: Conditional formatting based on sum of adjacent cells values and specific data

    See if this application of the inverse works.
    Selecting the range C2:J2 this should be the first rule: =AND(C2=0,OR($O2="",$N2=""))
    The 'Stop if True' box for this rule should be checked and No Format Set should show in the format window.
    If this doesn't produce the formatting results you are looking for it will help if you upload a sample (manually mocked up) showing what you want.
    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  9. #9
    Registered User
    Join Date
    09-05-2017
    Location
    London
    MS-Off Ver
    2013
    Posts
    17

    Re: Conditional formatting based on sum of adjacent cells values and specific data

    JeteMc, I have used =OR(C2=0,$n2=""), which seems to work as I wanted but the blank column issue remains as column b has numerical values in it, which are used to identify each product. This is resulting in c column values always being CF due to column b values.

  10. #10
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,548

    Re: Conditional formatting based on sum of adjacent cells values and specific data

    I think that it would help if an updated version of the spreadsheet were to be uploaded. Here is one that shows the application of 63falcondude's rules from post #6 and your rule from post #9. Please tell us what isn't happening that should happen or visa versa.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    09-05-2017
    Location
    London
    MS-Off Ver
    2013
    Posts
    17

    Re: Conditional formatting based on sum of adjacent cells values and specific data

    If you look on that sheet, for example: cell o5 total is 31 but the cells that are CF(cell c5, d5, and e5), only add up to only 30. The problem is cell d5 is not being CF. The reason for this is that the formula is using values in b5 to work out the total sum. As you delete the values in b5, cell f5 is highlighted.

    Hope this helps explain things.

  12. #12
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,548

    Re: Conditional formatting based on sum of adjacent cells values and specific data

    I gotcha. OK, in the formulas for red, yellow and green formatting, modify the part that currently reads: SUM($B2:B2)<$O2
    so that it will read: SUM($B2:B2)-$B2<$O2
    Let us know if you have any questions.

  13. #13
    Registered User
    Join Date
    09-05-2017
    Location
    London
    MS-Off Ver
    2013
    Posts
    17

    Re: Conditional formatting based on sum of adjacent cells values and specific data

    That did the job. Thanks 63falcondude and JeteMc.

  14. #14
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,548

    Re: Conditional formatting based on sum of adjacent cells values and specific data

    You're Welcome. Thank You for the feedback and for marking the thread as 'Solved'. I hope that you have a blessed day.

+ 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. Conditional Formatting to Check Adjacent Values in Cells
    By Saarang84 in forum Excel General
    Replies: 1
    Last Post: 05-27-2015, 09:32 AM
  2. Replies: 4
    Last Post: 07-25-2014, 05:17 AM
  3. Replies: 6
    Last Post: 06-03-2014, 08:40 PM
  4. [SOLVED] Conditional Formatting Based on Adjacent Cells and Values
    By stusic in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 01-03-2013, 03:59 PM
  5. macro for conditional formatting based on the comparing values from adjacent columns
    By jkmasurkar in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-18-2012, 07:18 AM
  6. Conditional formatting based on adjacent cell values
    By dberliner in forum Excel General
    Replies: 4
    Last Post: 07-28-2011, 12:42 PM
  7. [SOLVED] Conditional formatting of adjacent cells based on text in cell
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-07-2006, 07:20 PM

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