+ Reply to Thread
Results 1 to 3 of 3

Highlight cell based on total quantity value based on repeated order numbers

  1. #1
    Registered User
    Join Date
    12-29-2014
    Location
    Charlotte, NC
    MS-Off Ver
    Windows 7 Professional
    Posts
    4

    Highlight cell based on total quantity value based on repeated order numbers

    Hello all,

    I have a sheet that has duplicate order numbers that have different quantities (either 1 or -1).

    I am trying to build a macro that will look at the order number and add all the quantities for the rows and highlight the cells in column I. If the quantity for that order number is -1, highlight all the cells in column I red where the order number is the same in column G. If the sum of quantities for that order number are 0, highlight it green. If the total quantity sum is 1, leave it unfilled. (-1=Red; 0=Green; 1=Unfilled)

    An example is 224805, it appears twice, once with quantity 1 and again with quantity -1 in rows 5 and 6. I want it so that it recognizes the quantity as 0 and highlights I5 and I6 green. 257143 on row 21 only appears once with -1, so it would be highlighted red.

    Please see the attached file for an example that uses dummy data.
    Attached Files Attached Files

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Highlight cell based on total quantity value based on repeated order numbers

    Green rule

    =SUMIF($G:$G,$G5,$I:$I) = 0

    Red rule

    =SUMIF($G:$G,$G5,$I:$I) < 0

    Applies to

    =$I$5:$I$118

    in both cases
    Martin

  3. #3
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,648

    Re: Highlight cell based on total quantity value based on repeated order numbers

    You may try this. Please find the attached sheet and click on the Orange Button on Test Sheet to run the code.
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

+ 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. [SOLVED] Setting a selling price based on cost price and order quantity
    By Steven811 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-11-2014, 08:07 AM
  2. Replies: 0
    Last Post: 01-28-2014, 07:37 AM
  3. [SOLVED] Quantity in column D based on order amount of times the order no appears
    By djfscouse in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-19-2013, 06:48 PM
  4. Replies: 5
    Last Post: 11-23-2009, 06:24 PM
  5. Summing Total Sales, Based on Quantity & Price
    By ExcelTip in forum Tips and Tutorials
    Replies: 0
    Last Post: 08-28-2005, 11:08 AM

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