+ Reply to Thread
Results 1 to 13 of 13
  1. #1
    Registered User
    Join Date
    03-12-2009
    Location
    Virginia Beach, VA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Sum Multiple Criteria with Unique Value

    Alright,

    I believe this is a challenge. I am trying to calculate the number of transactions that have both a service and a retail component (tickets 253 and 258 have both service and retail components), and the sum of the total revenues, using an equation (not using multiple columns and the vlookup function). For the short list, I have highlighted the transactions in yellow (see attached file), but that was calculated manually. I can do this the long way by using a vlookup function, but it is not pretty and creates a massive file. I've been experimenting with sumifs, countifs, count unique equations, so on so forth, but to no avail. I will be impressed if someone can solve this. See attachment for easy viewing.

    Thank you,

    Barclay

    Ticket Number Service Type Charge
    252 Service $40
    253 Retail $33
    253 Service $162
    254 Retail $73
    255 Retail $69
    255 Retail $175
    256 Service $168
    257 Service $103
    258 Service $62
    258 Retail $127
    259 Retail $51
    260 Service $55
    261 Service $78
    262 Service $92
    263 Service $95


    Revenue Transactions
    Retail $528 6
    Service $855 9
    Retail & Service $384 2
    Attached Files Attached Files
    Last edited by bmcfiv; 03-12-2009 at 06:42 PM.

  2. #2
    Forum Moderator DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Suffolk, UK
    MS-Off Ver
    2002, 2007 & 2010
    Posts
    21,379

    Re: Sum Multiple Criteria with Unique Value

    My instinct would be to add a further column to your data set, such that:

    D6:
    =--ISNUMBER(LOOKUP(2,1/(($C$6:$C$20=$C6)*($D$6:$D$20<>$D6))))
    copied down to D20

    Then for your summary you can use:

    D26:
    =SUMIF($F$6:$F$20,1,$E$6:$E$20)

    E26:
    =SUMPRODUCT(--($F$6:$F$20=1),1/COUNTIF($C$6:$C$20,$C$6:$C$20&""))

  3. #3
    Valued Forum Contributor
    Join Date
    03-12-2004
    Posts
    323

    Re: Sum Multiple Criteria with Unique Value

    Try this...see attached.


    HTH
    Attached Files Attached Files

  4. #4
    Forum Moderator teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    2003 & 2010
    Posts
    10,042

    Re: Sum Multiple Criteria with Unique Value

    @Morrigan: my jaw dropped. Wow!
    teylyn
    Microsoft MVP - Excel
    At Excelforum, you can say "Thank you!" by clicking the icon below the post.

    Avoid pie charts with more than two data points. Why? See here (pdf, 559 kb). The only acceptable pie chart is here.

  5. #5
    Registered User
    Join Date
    03-12-2009
    Location
    Virginia Beach, VA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Sum Multiple Criteria with Unique Value

    Morrigan,

    Wow. That is absurd. Great work. I'm going to run on a spreadsheet with 25,000 entries tomorrow, I'll let you know how it goes.

    Maybe you should slow down your excel work and focus on solving cold fusion instead.

    Thanks a million,

    Barclay

  6. #6
    Forum Guru
    Join Date
    06-18-2004
    Location
    Canada
    Posts
    1,287

    Re: Sum Multiple Criteria with Unique Value

    Here's another way...

    D26, confirmed with CONTROL+SHIFT+ENTER:

    =SUM(IF(ISNUMBER(MATCH(C6:C20,IF(ISNUMBER(MATCH(IF(D6:D20="Retail",C6:C20),IF(D6:D20="Service",C6:C2 0,"#"),0)),C6:C20),0)),E6:E20))

    E26, confirmed with CONTROL+SHIFT+ENTER:

    =SUM(IF(ISNUMBER(MATCH(IF(D6:D20="Retail",C6:C20),IF(D6:D20="Service",C6:C20,"#"),0)),1))

    Hope this helps!

  7. #7
    Registered User
    Join Date
    03-12-2009
    Location
    Virginia Beach, VA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Sum Multiple Criteria with Unique Value

    Guys, thank you, everything worked like a charm. Now I'm going to dissect what you wrote, and try to figure out how the formulas work with one another.

    I decided to use DonkeyOte. It is the only one that is automatic and allows me to just dump the data with additional steps.

    Thanks Guys - next time hopefully I can find one more challenging.

  8. #8
    Forum Guru zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    Excel 2007
    Posts
    5,740

    Re: Sum Multiple Criteria with Unique Value

    Speaking of that solution...

    can someone tell me what "--" do in formulas TY
    "Relax. What is mind? No matter. What is matter? Never mind!"

  9. #9
    Valued Forum Contributor
    Join Date
    03-12-2004
    Posts
    323

    Re: Sum Multiple Criteria with Unique Value

    It turns the array into either 1 or 0. In short, when the argument is true, it returns a value of 1 otherwise it returns 0.

  10. #10
    Valued Forum Contributor
    Join Date
    03-12-2004
    Posts
    323

    Re: Sum Multiple Criteria with Unique Value

    It appears all the formula we have provided are automatic. What do you mean they aren't?


    Quote Originally Posted by bmcfiv View Post
    Guys, thank you, everything worked like a charm. Now I'm going to dissect what you wrote, and try to figure out how the formulas work with one another.

    I decided to use DonkeyOte. It is the only one that is automatic and allows me to just dump the data with additional steps.

    Thanks Guys - next time hopefully I can find one more challenging.

  11. #11
    Registered User
    Join Date
    03-12-2009
    Location
    Virginia Beach, VA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Sum Multiple Criteria with Unique Value

    Aren't the other solutions array's and require alt ctrl del to run the numbers every time a new set up data is placed?

    Also, why is there a 2 in Donk's lookup function?

    Thank you, may switch to single cell as a solution if I can understand the formulas.

  12. #12
    Valued Forum Contributor
    Join Date
    03-12-2004
    Posts
    323

    Re: Sum Multiple Criteria with Unique Value

    I am just guessing...perhaps your problem is as you add new data, the range in the formula doesn't update itself? If so, what I do usually is...include an extra row before and after your data in your range. See attached.

    If it's something else, you would have to explain more or I'd just go with what Donkey has suggested and use helper column.
    Attached Files Attached Files

  13. #13
    Forum Guru
    Join Date
    06-18-2004
    Location
    Canada
    Posts
    1,287

    Re: Sum Multiple Criteria with Unique Value

    Quote Originally Posted by bmcfiv View Post
    Aren't the other solutions array's and require alt ctrl del to run the numbers every time a new set up data is placed?
    The only time the array formula needs to be re-confirmed with CONTROL+SHIFT+ENTER is when the formula itself is edited.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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.2.0