+ Reply to Thread
Results 1 to 12 of 12

SumIf with sumrange in multiple variable columns

  1. #1
    Forum Contributor
    Join Date
    07-26-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2016 Office 365 ProPlus
    Posts
    822

    SumIf with sumrange in multiple variable columns

    Ok I have an exanple workbook attached.
    The situation:
    I have date waith ID numbers and amounts for months in the columns.

    Then I have an overview sheet in which it should show a summarized view.
    Now the formula has to sum for each ID the amount in the respective month.

    However I need YTD amounts.
    So in the JAN column it should sum form the data BB (beginning balance) and FEB column for that ID.
    For FEB it should sum in the columns BB/JAN and FEB and so on.

    Hope it makes sense.
    Example attached.
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    03-18-2015
    Location
    Windsor, England
    MS-Off Ver
    2013
    Posts
    13

    Re: SumIf with sumrange in multiple variable columns

    In D4 of Sheet2:

    =SUMPRODUCT((Sheet1!$A$2:$A$17=Sheet2!$C4)*(Sheet1!$B$2:C$17))

    And copy down and across...?

  3. #3
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: SumIf with sumrange in multiple variable columns

    Here!

    Put this in cell D4 on Sheet2

    Please Login or Register  to view this content.
    Cheers!
    Cheers!
    Deep Dave

  4. #4
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: SumIf with sumrange in multiple variable columns

    @ GaryBarlow

    Hi Gary, Are you sure that returns the right answer?

  5. #5
    Forum Contributor
    Join Date
    07-26-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2016 Office 365 ProPlus
    Posts
    822

    Re: SumIf with sumrange in multiple variable columns

    Hi Gary and msexcelathome,

    Well Garys give the correct total in D4 (73.117.176,93) and your msexcelathome only gives the total for JAN (1.836.147,45) and does not add column BB.

    But when I put it in y original file it gives me #VALUE! error.
    This is the formula:
    =SUMPRODUCT((ZHFM!A:A=DSO!$D25)*(ZHFM!AE:AF))

    And I do not understand why.
    Any ideas?

  6. #6
    Forum Contributor
    Join Date
    07-26-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2016 Office 365 ProPlus
    Posts
    822

    Re: SumIf with sumrange in multiple variable columns

    Well I have been playing around with the original formula and found if I change
    =SUMPRODUCT((Sheet1!$A$2:$A$17=Sheet2!$C4)*(Sheet1!$B$2:C$17))

    the first A17 to A18 it will go into error, but if I change the last C17 to C18 it works again.....
    Is it really that sensitive??

    And if so, how can I make that range variable? critaria range is entire column A because the imput data can vary in rows.

  7. #7
    Registered User
    Join Date
    03-18-2015
    Location
    Windsor, England
    MS-Off Ver
    2013
    Posts
    13

    Re: SumIf with sumrange in multiple variable columns

    Hello rpinxt

    How many rows will your maximum be?
    If < 10,000 then:

    =SUMPRODUCT((Sheet1!$A$2:$A$9999=Sheet2!$C4)*(Sheet1!$B$2:C$9999))

    Using SUMPRODUCT on a whole column can cause resourcing problems...

  8. #8
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: SumIf with sumrange in multiple variable columns

    I am sorry, it seems I have understood the problem wrongly..

  9. #9
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: SumIf with sumrange in multiple variable columns

    D4=SUMPRODUCT((Sheet1!$A$2:$A$17=$C4)*(Sheet1!$B$2:INDEX(Sheet1!$B$17:$F$17,,MATCH(D$3,Sheet1!$B$1:$F$1,0))))
    Try this and copy across
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  10. #10
    Forum Contributor
    Join Date
    07-26-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2016 Office 365 ProPlus
    Posts
    822

    Re: SumIf with sumrange in multiple variable columns

    Gary, well it will be at least between 5000 and 10000 lines...
    But I tried with a range up to 10000 but somehow in my original sheet it returns zero as a result.
    At least no error messages but it sums nothing.

    Well maybe it sums everything in that range and then it will be zero yes.
    But it needs only to sum the criteria.

    @nflsales,
    thanks but it gives me an error.
    I use " ; " as a separator for formulas, but even when I do this it does not work for me.
    I also see a double comma in there, is that correct?

  11. #11
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: SumIf with sumrange in multiple variable columns

    see the attached file
    Attached Files Attached Files

  12. #12
    Forum Contributor
    Join Date
    07-26-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2016 Office 365 ProPlus
    Posts
    822

    Re: SumIf with sumrange in multiple variable columns

    Thanks nflsales! With the help of the sheet I could copy and paste.
    the double comma need for me to be a double ;.

    With some tweaking I finally got it to work in my real data.
    But still can somebody tell me why the formula will not work when you do:
    SUMPRODUCT((Sheet1!A:A=$C4).....

    But will work like :
    SUMPRODUCT((Sheet1!$A$2:$A$17=$C4)*(

    so range A2-A17 yes but range A-A whole column is a no...

+ 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. Summing variable values across variable sheets in multiple columns
    By rdelosh74 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-27-2014, 02:16 PM
  2. SumIf with variable columns
    By garethdjohn in forum Excel General
    Replies: 2
    Last Post: 05-15-2012, 04:46 AM
  3. Replies: 4
    Last Post: 01-14-2011, 09:30 PM
  4. SUMIF with multiple variable
    By ciao.polly in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-22-2007, 10:15 PM
  5. How to sumif with multiple range and single sumrange
    By helpplease! in forum Excel General
    Replies: 4
    Last Post: 11-05-2007, 11:53 AM

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