+ Reply to Thread
Results 1 to 5 of 5

Conditional sum without changing source sheet

  1. #1
    Registered User
    Join Date
    06-05-2012
    Location
    Bern, Switzerland
    MS-Off Ver
    Excel 2003
    Posts
    62

    Conditional sum without changing source sheet

    Hi!

    I am trying to make a sum based on several conditions. I have an array which has a column for each day, the corresponding week number, and names as line headings which can appear several times and have to be combined.

    Week 20 20 21 21 21 21 21 21 21 22 22
    Bob 1 0 4 5 6 7 8 3 2 4 1
    Jack 2 9 16 23 30 37 44 51 58 65 72
    Bill 1 1 1 1 1 1 1 1 1 1 1
    April 4 7 10 13 16 19 22 25 28 31 34
    Bill 1 1 1 1 1 1 1 1 1 1 1


    Until now, I use =SUMPRODUCT((C11:M11=21)*(B12:B16="Bill");C12:M16), which sums up all values done by Bill on days of week 21 (see attachement).

    My problem: I need to make a condition, which will eliminate the day which is next to week 20 (Sunday), and the day which is next to 22 (Saturday). The result should be 10 instead of 14. I am not allowed to change the source table (e.g. add a line).

    Does anyone have an idea, how to do this without macros?

    Thanks!!
    Attached Files Attached Files

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Conditional sum without changing source sheet

    Try this:

    =SUMPRODUCT((C11:M11=21)*(B12:B16="Bill")*(C11:M11=B11:L11)*(C11:M11=D11:N11),C12:M16)
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Contributor
    Join Date
    08-14-2006
    Location
    USA
    MS-Off Ver
    2019
    Posts
    686

    Re: Conditional sum without changing source sheet

    =SUMPRODUCT((C11:M11=21)*(B12:B16="Bill"),C12:M16) - SUMIF(B12:B16,"Bill",INDIRECT(ADDRESS(12,MATCH(21,A11:K11,0))&":"&ADDRESS(16,MATCH(21,A11:K11,0)))) - SUMIF(B12:B16,"Bill",INDIRECT(ADDRESS(12,MATCH(21,A11:K11,1))&":"&ADDRESS(16,MATCH(21,A11:K11,1))))

    however, it only works if there is actually a column heading 22 (which you sample workbook did not contain.
    which means week 52 will fail if there is not a week 53!

  4. #4
    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: Conditional sum without changing source sheet

    A variation of Jerrys' formula
    Please Login or Register  to view this content.
    Drag/Fill Down
    Where
    D20 Bill
    D21 Bob
    D22 Jack
    D23 April
    Attached Files Attached Files
    Last edited by Marcol; 06-05-2012 at 11:18 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.

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Conditional sum without changing source sheet

    Thanks for the feedback, Stefan.

    If that takes care of your need, please select Thread Tools from menu above and set this topic to SOLVED.

+ 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