+ Reply to Thread
Results 1 to 8 of 8

Sum of different quantities by product code

  1. #1
    Registered User
    Join Date
    07-18-2019
    Location
    UK
    MS-Off Ver
    2016
    Posts
    25

    Sum of different quantities by product code

    Hi all,
    I am looking for a formula to sum quantities of different codes, that fall within different time brackets.
    For example, in the attachment, in cells L3, L6 and L9, I need to sum the quantities of the different product codes, which are in column F (so cell L3 should read 25, cell L6 should read 45 and cell L9 should be blank (not 0) ).
    I then need to replicate this for all the “plan” rows, in columns K,L and M.

    Many thanks for any help, appreciated.
    Attached Files Attached Files

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,885

    Re: Sum of different quantities by product code

    Ah! A nightmare in merged cells ...

    And something tells me it's not even as straightforward as this. Would I be right?
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Sum of different quantities by product code

    They're not merged, Ali!

    GLewis14, others need to learn from your approach.

    If you change K2 to '02 MONDAY so that it matches column B, then change K2:M2 to Shift 1, Shift 2 and Shift 3, then this formula in K3 and copied to the other cells will do what you need.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,885

    Re: Sum of different quantities by product code

    You're right, Jason - should have looked closer. More caffeine, methinks ...

    I agree - this is a good approach - I have used it myself and set conditional formatting to show or hide the text as appropriate.

  5. #5
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Sum of different quantities by product code

    I do similar, but tend to go with a subtle difference between font and fill colour so that I can still see what is there.

    I'm AFK for a few hours, but one quick observation, the times in column D are actually 'text' numbers. If my earlier suggestion is not suitable for what is needed, then these would need to be proper times before they can be used for formulas.

  6. #6
    Registered User
    Join Date
    07-18-2019
    Location
    UK
    MS-Off Ver
    2016
    Posts
    25

    Re: Sum of different quantities by product code

    Thanks Jason

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,885

    Re: Sum of different quantities by product code

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  8. #8
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Sum of different quantities by product code

    As usual, I'm going to make it so much more complicated (at first glance), and suggest using PowerPivot.

    First of all, give your data (B:F) headings, then format as a table.

    Now we can use Power Query to reshape the data, a bit:

    Product Data:
    Please Login or Register  to view this content.
    Close and Load To the Data Model.

    Now in PowerPivot, create a few measures:

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    This didn't take much longer than the single formula solution, but now we can produce really flexible, scalable pivot reports. See attachment for worked example.
    Attached Files Attached Files
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

+ 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. Replies: 9
    Last Post: 11-13-2017, 04:33 AM
  2. [SOLVED] Use vlookup to change old product code to new product code
    By unclejemima in forum Excel General
    Replies: 2
    Last Post: 01-08-2017, 05:28 PM
  3. Replies: 6
    Last Post: 02-21-2016, 04:15 AM
  4. [SOLVED] Sum quantities of product by year
    By relu1979 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 12-27-2013, 12:47 PM
  5. Link product image to product code
    By rogan in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-10-2013, 02:51 AM
  6. [SOLVED] 4 digit code for similar product, new product unique code
    By unclejemima in forum Excel General
    Replies: 47
    Last Post: 06-06-2013, 01:02 PM
  7. [SOLVED] Need Function that will find ordered product, and display the product code in a 2nd workbk
    By rollerden in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-21-2012, 08:52 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