+ Reply to Thread
Results 1 to 14 of 14

Summing up for specific criteria

  1. #1
    Registered User
    Join Date
    09-14-2011
    Location
    Leeds, England
    MS-Off Ver
    Excel 2007
    Posts
    19

    Summing up for specific criteria

    I'm hoping someone can help me out here.

    I have 2 tables. Each table has 2 columns. In the left hand column is a letter or a letter followed by a number, and in the right hand column is a numeric value that corresponds with the left hand column.

    I want to be able to enter multiple letters and/or letters with numbers into a cell, for example A,B,A1,C,D,A3, and have the corresponding values of those letters summed up in the adjacent cell.

    I'd imagine it would be a sumproduct but I can't work out how use it for specific criteria.

    How would I do this?
    Attached Files Attached Files
    Last edited by PapaCheese; 05-08-2012 at 10:44 AM.

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Summing up for specific criteria

    excel isnt really designed to have all that stuff in one cell,in would be probably be easier with code
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Summing up for specific criteria

    How about

    In H3
    =SUM(SUMIFS($E$3:$E$12,$D$3:$D$12,{"A","B","C"}))+SUMIFS($B$3:$B$14,$A$3:$A$14,"B1")

    In H4
    =SUM(SUMIFS($E$3:$E$12,$D$3:$D$12,{"D","E","F"}))+SUM(SUMIFS($B$3:$B$14,$A$3:$A$14,{"A1","A3"}))

    In H5
    =SUM(SUMIFS($E$3:$E$12,$D$3:$D$12,{"G","H","I","J"}))
    Last edited by jeffreybrown; 05-08-2012 at 09:13 AM.
    HTH
    Regards, Jeff

  4. #4
    Registered User
    Join Date
    09-14-2011
    Location
    Leeds, England
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Summing up for specific criteria

    The formula I was using when I just had the second table was:

    =SUMPRODUCT(--ISNUMBER(SEARCH($D$3:$D$12, G3)), $E$3:$E$12)

    ...which worked great until I added in the other table. When I put another sumproduct on the end of that one for the other table, if I type "A" into H3 then it would sum up all the As (A,A1,A2,etc), instead of just A. So how would I tell it to sum the specific cell of A instead of all the As?

  5. #5
    Forum Expert
    Join Date
    09-27-2011
    Location
    Poland
    MS-Off Ver
    Excel 2007
    Posts
    1,312

    Re: Summing up for specific criteria

    Hi maybe pivot table will be the option
    Attached Files Attached Files
    Regards

    tom1977

    If You are satisfied with my solution click the small star icon on the left to say thanks.

  6. #6
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Summing up for specific criteria

    Hi PapaCheese,

    I'm definetly not one of the formula guru's, but what is wrong with what I posted? As Martin stated, not so sure this can be done with a formula by picking out requirements in one cell seperated by commas. I would imagine a UDF could do this, but not so adept at creating a UDF for this purpose.

  7. #7
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Summing up for specific criteria

    with formulas splitting vlook then add this caters for 7 single or double alphas in col g
    Attached Files Attached Files

  8. #8
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Summing up for specific criteria

    The formula I was using when I just had the second table was:
    So why not add another SUMPRODUCT() formula?
    Please Login or Register  to view this content.
    [EDIT]
    See revised post #11
    Last edited by Marcol; 05-08-2012 at 10:32 AM.

  9. #9
    Forum Expert icestationzbra's Avatar
    Join Date
    01-07-2004
    MS-Off Ver
    2007, 2010
    Posts
    1,421

    Re: Summing up for specific criteria

    if you can layout your data in a friendly way, you could achieve the sum a wee bit easily...
    Attached Files Attached Files
    Last edited by icestationzbra; 05-09-2012 at 06:59 AM. Reason: trimmed comparison
    - i.s.z -
    CSE, aka Array aka { }, formulae are confirmed with CONTROL+SHIFT+ENTER.
    Replace commas ( , ) with semicolons ( ; ) in formulae, if your locale setting demands.
    All good ideas are courtesy resources from this forum as well as others around the web.
    - e.o.m -

  10. #10
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Summing up for specific criteria

    Again, not a formula guru, but in just trying to understand the functioning of the Sumproduct method,

    what if your table has

    A,B1,C
    D,E,F,A1

    =SUMPRODUCT(--ISNUMBER(SEARCH($A$3:$A$14,G3)), $B$3:$B$14)+SUMPRODUCT(--ISNUMBER(SEARCH($D$3:$D$12, G3)),$E$3:$E$12)

    would give you 9 and 16 respectively when it looks like it should be 8 and 15

    ...unless of course I am missing something

  11. #11
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Summing up for specific criteria

    Just noticed that Jeff
    It should be
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by Marcol; 05-08-2012 at 10:28 AM. Reason: Added Attachment
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  12. #12
    Forum Expert icestationzbra's Avatar
    Join Date
    01-07-2004
    MS-Off Ver
    2007, 2010
    Posts
    1,421

    Re: Summing up for specific criteria

    if we use the SUMPRODUCT method coupled with SEARCH, the letter value for A is added twice - once for A, once for A1 - if the input string (comma separated multiple values in one cell) has A1.

    EDIT:

    two things - if you ever have fat-fingered white-spaces, there will be problems in handling that situation with most formulae, except for those where the layout is multi-cellular (each value in a separate cell). also, if you have a situation (i dont know if you will) where an alphabet is repeated (A, A, A1), there the SUMPRODUCT formula does not seem to catch the repetition (the SUM(IF... does). but, what do i know :-), i am still learning.
    Last edited by icestationzbra; 05-08-2012 at 11:32 AM. Reason: stress testing

  13. #13
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Summing up for specific criteria

    @ icestationzbra checkout the workbook in post#11

  14. #14
    Registered User
    Join Date
    09-14-2011
    Location
    Leeds, England
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Summing up for specific criteria

    Quote Originally Posted by marcol View Post
    just noticed that jeff
    it should be
    Please Login or Register  to view this content.
    Marcol that's exactly what I was looking for, thanks. And thanks everyone else for taking the time to reply.
    Last edited by PapaCheese; 05-08-2012 at 11:02 AM.

+ Reply to Thread

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.6.0 RC 1