+ Reply to Thread
Results 1 to 14 of 14

Sum of values with unique criteria in different columns

  1. #1
    Registered User
    Join Date
    02-12-2013
    Location
    Connecticut
    MS-Off Ver
    Excel 2010
    Posts
    50

    Sum of values with unique criteria in different columns

    Hi Everyone,

    I have question about summing up of values in a column based upon criteria in a different column (I can't use macros or VBA). I've attached a sample spreadsheet, where I need a value calculated in Column H (highlighted in Yellow). Let me explain...

    I have different items (Column A) that use different Flavors (Column C) in a certain Quantities (Column B). Some of the Items may be duplicated (in Column A...like SKU-1 & SKU-2) and some Items may not have any Quantity Used (Column B...like SKU-3 in B14 and SKU-222 in B16).

    What I want is to sum all of the Flavor Used (by Flavor) in H2 to H8, summing up the Quantities (Column B) of only the unique values of Items (Column A). In other words, I don't want to count SKU-1's Quantities twice (since they appear twice), only once.

    Thus, the total of Vanilla used (formula needed for H2) should be 171, not 173 (if B13 is counted, as a duplicate of B2) and the total of Chocolate (formula needed for H3) should be 31, not 40 (if B15 is counted, as a duplicate of B3).

    I know (or rather think) that some use of SUMIF or SUMIFS is a good way to go, but I'm a bit stuck (I can get the SUMIF to work, but my version is counting multiple instances of the same SKU). I found a possible idea at http://www.excelforum.com/excel-gene...-criteria.html, but I need it as a Summary table, like I have in my sample spreadsheet.

    BTW, I cannot add any new colums to the original spreadsheet (i.e. I can't add info to Column D), but I can do whatever I want in Column J and beyond (the summary table is editable, but the original info is not).

    Can somebody help please?

    Thank you in advance,

    Yury
    Attached Files Attached Files

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,063

    Re: Sum of values with unique criteria in different columns

    The helper column solution is very easy and it can (of course) be hidden.
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Sum of values with unique criteria in different columns

    Hi
    Use in H2 and copy down
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    11-28-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Sum of values with unique criteria in different columns

    Try this and reply if it works or not
    Attached Files Attached Files

  5. #5
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Sum of values with unique criteria in different columns

    to correct formula in post #2

    Hi
    Use in H2 and copy down
    Formula: Select Code copy to clipboard
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    02-12-2013
    Location
    Connecticut
    MS-Off Ver
    Excel 2010
    Posts
    50

    Re: Sum of values with unique criteria in different columns

    Hi Jose,

    Thank you for the formula, but it's still "double counting" duplicate instances of the same Item (from Column A). The correct calculation for H2 is "171", but your formula is showing "174" (even the updated formula that you reposted)...this is also the case in H3, which should be "31", but your formula is showing "40".

    Any way to not "double count" without using a "helper" column?

    Let me know. Thank you,

    Yury

  7. #7
    Registered User
    Join Date
    02-12-2013
    Location
    Connecticut
    MS-Off Ver
    Excel 2010
    Posts
    50

    Re: Sum of values with unique criteria in different columns

    Hi Glenn,

    Thank you for your response, but it uses a "Helper" column, which I cannot use/add to the original data set. Is there any way to do this without a "Helper" column in the original data?

    I can certainly put the "Helper" column in the Summary Sheet (and then hide it), but is there a way not to use a "Helper" column, if possible? If not, I will use this column and hide it in the Summary sheet.

    Thank you in advance,

    Yury

  8. #8
    Registered User
    Join Date
    02-12-2013
    Location
    Connecticut
    MS-Off Ver
    Excel 2010
    Posts
    50

    Re: Sum of values with unique criteria in different columns

    Hi hitesh102,

    Thank you for your response, but (like Glenn) it uses a "Helper" column, which I cannot use/add to the original data set. Is there any way to do this without a "Helper" column in the original data?

    I can certainly put the "Helper" column in the Summary Sheet (and then hide it), but is there a way not to use a "Helper" column, if possible? If not, I will use this column and hide it in the Summary sheet.

    Thank you in advance,

    Yury

  9. #9
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Sum of values with unique criteria in different columns

    Enter in H2 and copy down
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  10. #10
    Registered User
    Join Date
    02-12-2013
    Location
    Connecticut
    MS-Off Ver
    Excel 2010
    Posts
    50

    Re: Sum of values with unique criteria in different columns

    Hi AlKey,

    Thank you for the great solution! It works perfectly!

    Yury

  11. #11
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Sum of values with unique criteria in different columns

    Hi
    I suppose not work well.

    If you clean B3 the formula must be work because SKU-2 is 9 in B15

    The formula I proposed is based on AlKey solution but it is an array formula (must be enter with CTRL+SHIFT+ENTER)
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  12. #12
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Sum of values with unique criteria in different columns

    Agreed.
    Here is an adjusted formula
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    02-12-2013
    Location
    Connecticut
    MS-Off Ver
    Excel 2010
    Posts
    50

    Re: Sum of values with unique criteria in different columns

    Hi Jose,

    Thank you for your adjustment! I didn't see that oversight. I was so happy that the formula worked better than what I could come up with, that I stopped double checking after the first 2 rows (that were correct) .

    Thank you for helping me on this.

    All the best,

    Yury

  14. #14
    Registered User
    Join Date
    02-12-2013
    Location
    Connecticut
    MS-Off Ver
    Excel 2010
    Posts
    50

    Re: Sum of values with unique criteria in different columns

    Thank you AlKey,

    Your formula (with Jose's adjustment) works great! Thank you again for your help .

    Yury

+ 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. Count unique values in columns based on 2 criteria (error in one result)
    By t83357 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-17-2013, 03:25 PM
  2. [SOLVED] Count unique values in columns based on 2 criteria
    By t83357 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-12-2013, 04:33 PM
  3. count unique values of 2 columns with criteria
    By kbalasub in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 02-16-2013, 12:15 PM
  4. Count unique values across 2 columns with multiple criteria
    By Skywalker01 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-29-2012, 08:04 AM
  5. Replies: 6
    Last Post: 10-18-2011, 07:34 PM
  6. Replies: 11
    Last Post: 06-09-2011, 03:17 PM

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