+ Reply to Thread
Results 1 to 17 of 17

Summing multiple rows with the same item number - How do you interpret this code (inside)

  1. #1
    Registered User
    Join Date
    12-24-2013
    Location
    lancaster, pa
    MS-Off Ver
    Excel 2003
    Posts
    74

    Question Summing multiple rows with the same item number - How do you interpret this code (inside)

    Hello,

    Thanks for any insight!

    I'm trying to interpret what this function represents in plain english:
    Please Login or Register  to view this content.
    They way I read it is that: if the item has B in b10 sum these columns.

    What does the "...C10<>C9)" and ("C:C", C10,P:P)" mean/represent?

    The reason I ask, is that if I highlight a row and copy/insert copied cells, the total that comes up in the column sometimes behaves oddly (as in doesn't report the proper total)

    Thanks!

  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,703

    Re: Summing multiple rows with the same item number - How do you interpret this code (insi

    There are two conditions being tested, and only if both of them are TRUE will the sum appear. The two conditions are that B10 is equal to the letter "B" AND C10 is not equal to C9. If that is the case then the second part of the formula will kick in, and this is a conditional sum, meaning that you want the sum of the cells from column P but only where the corresponding cell in column C is equal to C10, otherwise a blank will appear as the result.

    I suspect that you have items in column C that have been sorted, and that you want a sum total of the cells from column P for the particular item in column C, but for this to appear only on the first occurrence of the item in C (and at the same time for the cell in column B to equal "B").

    Hope this helps.

    Pete

  3. #3
    Registered User
    Join Date
    12-24-2013
    Location
    lancaster, pa
    MS-Off Ver
    Excel 2003
    Posts
    74

    Re: Summing multiple rows with the same item number - How do you interpret this code (insi

    That does help, and i think I know part of my problem.
    If I'm understanding what you just explained, me copying and inserting one row directly above each other, thus both columns having the same #. So since the inserted row above the original is equal to the one below the SUMIF section of the formula isn't happening.

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

    Re: Summing multiple rows with the same item number - How do you interpret this code (insi

    It would help if you attached a sample Excel workbook.

    To do this, click on Go Advanced (below the Edit Window) while you are composing a reply, then scroll down to and click on Manage Attachments and the Upload window will open. Click on Browse and navigate to (and double-click) the file icon that you want to attach, then click on Upload and Close this Window to return to the Edit window. When you have finished composing your post, click on Submit Post.

    Pete

  5. #5
    Registered User
    Join Date
    12-24-2013
    Location
    lancaster, pa
    MS-Off Ver
    Excel 2003
    Posts
    74

    Re: Summing multiple rows with the same item number - How do you interpret this code (insi

    Whoops. Replied to an outdated page

  6. #6
    Registered User
    Join Date
    12-24-2013
    Location
    lancaster, pa
    MS-Off Ver
    Excel 2003
    Posts
    74

    Re: Summing multiple rows with the same item number - How do you interpret this code (insi

    Quote Originally Posted by Pete_UK View Post
    It would help if you attached a sample Excel workbook.

    To do this, click on Go Advanced (below the Edit Window) while you are composing a reply, then scroll down to and click on Manage Attachments and the Upload window will open. Click on Browse and navigate to (and double-click) the file icon that you want to attach, then click on Upload and Close this Window to return to the Edit window. When you have finished composing your post, click on Submit Post.

    Pete
    Is there a way to ADD a condition to which the sumif kicks out a total? Right now its looking at the item number in C. Can I have it look at item number in C and a manufacturer name from another column (and if they are different a separate sum is calculated)? So they can share the same item number(which is why its summing things weird)

  7. #7
    Forum Expert
    Join Date
    12-11-2011
    Location
    Netherlands
    MS-Off Ver
    office 365
    Posts
    3,284

    Re: Summing multiple rows with the same item number - How do you interpret this code (insi

    Try the SUMIFS function
    SYNTAX: SUMIFS(sum_range, criteria_range1, criteria1, [criteria_range2, criteria2], ...)

    This function is available from version excel 2007
    Willem
    English is not my native language sorry for errors
    Please correct me if I'm completely wrong

  8. #8
    Registered User
    Join Date
    12-24-2013
    Location
    lancaster, pa
    MS-Off Ver
    Excel 2003
    Posts
    74

    Re: Summing multiple rows with the same item number - How do you interpret this code (insi

    Quote Originally Posted by popipipo View Post
    Try the SUMIFS function
    SYNTAX: SUMIFS(sum_range, criteria_range1, criteria1, [criteria_range2, criteria2], ...)

    This function is available from version excel 2007
    I looked at it a little, and not quite sure how I would go about doing it.

    In the attached example at the bottom you can see there are two sets of item 1003. Each set starts with "B" as a base item and then has "O" or optional items that are part of the base item. These two sets of 1003 need to be summed separately in column U (LIP). So C16:C19 and C20:C23 would sum column P individually.
    The "make" column F would have different values in the two sets of item 1003 which I think could be used as a criteria to sum them individually. I'm not sure how you would go about this though.

    Thanks for you help!
    Attached Files Attached Files

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

    Re: Summing multiple rows with the same item number - How do you interpret this code (insi

    Try modifying the formula in column U as follows and see if it does what you want:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Let me 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.

  10. #10
    Registered User
    Join Date
    12-24-2013
    Location
    lancaster, pa
    MS-Off Ver
    Excel 2003
    Posts
    74

    Re: Summing multiple rows with the same item number - How do you interpret this code (insi

    Quote Originally Posted by JeteMc View Post
    Try modifying the formula in column U as follows and see if it does what you want:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Let me know if you have any questions.
    Well it sort of accomplishes a part of the problem, but it seems the formula isn't looking at the item numbers? I could have 50 lines, all with unique item numbers and have the same value in the F column, but the formula should only total each occurrence of the item number individually (the B and O part of the item number in column A). The formula you wrote (thanks by the way), totals ALL the cells with the same value in column F (even though they have different item numbers).
    Does that make sense?

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

    Re: Summing multiple rows with the same item number - How do you interpret this code (insi

    I may have misunderstood post #8 however the formula is summing item #'s 1001 and 1002 separately ($1680 and $880) and then sums the "two sets of 1003" which "need to be summed separately in column U (LIP)" (both $610, however if you change D22 to 1 then only U20 changes, to $595).
    My suggestion is to manually put some numbers in column U so that we can see what you expect the formula to yield.

  12. #12
    Registered User
    Join Date
    12-24-2013
    Location
    lancaster, pa
    MS-Off Ver
    Excel 2003
    Posts
    74

    Re: Summing multiple rows with the same item number - How do you interpret this code (insi

    Quote Originally Posted by JeteMc View Post
    I may have misunderstood post #8 however the formula is summing item #'s 1001 and 1002 separately ($1680 and $880) and then sums the "two sets of 1003" which "need to be summed separately in column U (LIP)" (both $610, however if you change D22 to 1 then only U20 changes, to $595).
    My suggestion is to manually put some numbers in column U so that we can see what you expect the formula to yield.
    Ok, try this attachment.

    Thanks!
    Attached Files Attached Files

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

    Re: Summing multiple rows with the same item number - How do you interpret this code (insi

    Different approach. Since every item has a base price plus prices for options, lets just start with each base and add any options that occur after that. To do this I have added three helper columns, which may be hidden for aesthetic purposes. The helper columns find the addresses of the base and last option using formulas like:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    The formula in column U sums that range using:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Let me know if you have any comments/questions.
    Attached Files Attached Files

  14. #14
    Registered User
    Join Date
    12-24-2013
    Location
    lancaster, pa
    MS-Off Ver
    Excel 2003
    Posts
    74

    Re: Summing multiple rows with the same item number - How do you interpret this code (insi

    Quote Originally Posted by JeteMc View Post
    Different approach. Since every item has a base price plus prices for options, lets just start with each base and add any options that occur after that. To do this I have added three helper columns, which may be hidden for aesthetic purposes. The helper columns find the addresses of the base and last option using formulas like:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    The formula in column U sums that range using:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Let me know if you have any comments/questions.
    Well I tried integrating it, but I'm having a problem (I shifted your helper cells over to columns Y,Z, and AA. In column AA I'm getting "#N/A" and if I go into the cell and hit enter to try and 'refresh' the formula I receive a "Run-time error '13': Type Mismatch".

    Any idea what would be causing this?

    It looks like it works awesome in the sample you uploaded though, thanks!

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

    Re: Summing multiple rows with the same item number - How do you interpret this code (insi

    Manually change the column references in the formula from W to Z as in:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Let me know if you have any questions.

  16. #16
    Registered User
    Join Date
    12-24-2013
    Location
    lancaster, pa
    MS-Off Ver
    Excel 2003
    Posts
    74

    Re: Summing multiple rows with the same item number - How do you interpret this code (insi

    Quote Originally Posted by JeteMc View Post
    Manually change the column references in the formula from W to Z as in:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Let me know if you have any questions.
    I had already manually updated the columns, but its still creating the error

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

    Re: Summing multiple rows with the same item number - How do you interpret this code (insi

    The only other thing that I can think of that I did was to insert three columns as there was already something in columns Y and Z. Here is my copy of the file with the formulas shifted to columns Y:AA, perhaps you can spot if anything differs between my copy and yours.
    Hope that this is helpful.
    Attached Files Attached Files

+ 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: 3
    Last Post: 11-23-2015, 01:49 PM
  2. Macro Code to pull multiple images from the list of item number in colmn A
    By tantcu in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-20-2015, 03:56 PM
  3. Searching Item Code And Item Number
    By Shi in forum Excel General
    Replies: 3
    Last Post: 11-23-2013, 03:33 AM
  4. [SOLVED] Summing a spesific number of rows
    By Test123Test in forum Excel General
    Replies: 5
    Last Post: 04-22-2012, 10:19 AM
  5. Replies: 3
    Last Post: 02-09-2011, 08:40 PM
  6. find a number by summing rows
    By jseufert in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-10-2009, 12:46 PM
  7. [SOLVED] Interpret code
    By FIRSTROUNDKO via OfficeKB.com in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-22-2006, 02:25 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