+ Reply to Thread
Results 1 to 7 of 7

Sumproduct multiple ranges with multiple conditions

  1. #1
    Registered User
    Join Date
    12-21-2018
    Location
    IL
    MS-Off Ver
    Newest
    Posts
    3

    Sumproduct multiple ranges with multiple conditions

    A bit similar to this* (I'm not allowed to post links), I have multiple ranges (in this case complicated Pivot tables) arranged by dates. But not all of them have all dates and not all of them have all columns.
    I want to prepare a new table that sums up each dates with each type of column.
    Can you help me do it, probably with sumproduct? Sample file attached**.
    I can stack the ranges on top of each other, if it helps.

    * excelforum.com/excel-formulas-and-functions/944670-sumproduct-multiple-criteria-in-same-column-and-criteria-not-hard-coded.html
    ** In the attached sample file, if row 28 (16/12/2018), for example, is done manually, it will look like:
    Cell B28: =SUM(B6, F5)
    Cell C28: =SUM(G5, K4)
    Cell D28: =SUM(C6, H5, L4)

    g8JGn.png

    Thanks!
    Attached Files Attached Files
    Last edited by lwcorp; 12-21-2018 at 11:11 AM. Reason: Added sample file

  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
    43,893

    Re: Sumproduct multiple ranges with multiple conditions

    Will you please attach a SMALL sample Excel workbook (10-20 rows of data is usually enough)? However, please give us an indication of the approximate number of rows of data you want the solution to work with (100, 1000, 100,000 or whatever). Please don't attach a picture of an Excel sheet (no-one will want to re-type all your stuff before starting).

    1. It does NOT have to be your real sheet - mock up a SAMPLE if you need to. But not 1000's of rows!!! It makes manual checking so tedious. Whatever you do... make sure that all confidential information is removed first!!

    2. Make sure that your sample data are truly REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    3. Make sure that your desired solution is also shown (mock up the results manually).

    4. Try to avoid using merged cells. They cause lots of problems!

    Unfortunately the attachment icon doesn't work at the moment. So, to attach an Excel file you have to do the following: Just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.
    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
    Registered User
    Join Date
    12-21-2018
    Location
    IL
    MS-Off Ver
    Newest
    Posts
    3

    Re: Sumproduct multiple ranges with multiple conditions

    Done, now attached. It's identical to what I need.

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    79,388

    Re: Sumproduct multiple ranges with multiple conditions

    Please see this forum's rules regarding cross-posting. As you are new here, I shall provide a link for you this time, but you must disclose cross-posts in future. Thanks for your co-operation.

    https://www.mrexcel.com/forum/excel-...onditions.html
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  5. #5
    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
    43,893

    Re: Sumproduct multiple ranges with multiple conditions

    There is an easy way to do this... with a little manual intervention.

    1. Delete your Pivot tables. The time you spend updating them will be more than you will take at step 2.


    2. In each raw data table, insert an empty column in each Table so tht the relationship Date:XXX:Gross Revenue:Cost:Fee is maintained.

    3. the use this formula in B3, copied across and down:

    =SUMPRODUCT((Raw!$A$2:$O$40=$A3)*(Raw!C$1:Q$1=B$2),Raw!C$2:Q$40)

    However, remember that you need to stagger the range so that if the range for the dates starts/finishes in column A/O, that the range for gross revenue has to run from C/Q - two later, in agreement with the structure Date:XXX:Gross Revenue:Cost:Fee


    The alternative fromulae, if you are unwilling to adjust the raw data, are truly horrendous (3 lines per raw dataset). Just don't go there.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    12-21-2018
    Location
    IL
    MS-Off Ver
    Newest
    Posts
    3

    Re: Sumproduct multiple ranges with multiple conditions

    Sorry about not disclosing the CP, I thought each site wants to be independent. Imagine if there had been one central forum for all Excel related matters...
    Glenn, that's a step in the right direction! However, your solution assumes 3 sources. Each time a new source is added the formulas will need to be changed.

  7. #7
    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
    43,893

    Re: Sumproduct multiple ranges with multiple conditions

    Yes, but the change required is minimal.

    I already told you that:

    "However, remember that you need to stagger the range so that if the range for the dates starts/finishes in column A/O, that the range for gross revenue has to run from C/Q - two later, in agreement with the structure Date:XXX:Gross Revenue:Cost:Fee
    "

    Make it for your max no. and it'll be OK for all. I have here adjusted the range to look out as far as column AZ and down as far as row 1000. It works perfectly, as you paste in more data tables.

    Surely this is EXACTLY what you wanted and not "a step in the right direction"??
    Attached Files Attached Files
    Last edited by Glenn Kennedy; 12-23-2018 at 05:23 AM.

+ 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. Replies: 1
    Last Post: 07-20-2018, 11:14 PM
  2. =SUMPRODUCT with multiple conditions
    By maxhecht2 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-24-2017, 10:22 AM
  3. Sum Multiple Different Ranges or Conditions
    By meghs918 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-29-2015, 02:25 PM
  4. [SOLVED] Sumproduct with multiple conditions help
    By Murphy15 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-31-2013, 03:28 PM
  5. Replies: 1
    Last Post: 01-31-2012, 03:40 AM
  6. Multiple Ranges & Conditions
    By WebXcelMan in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 08-28-2007, 04:06 PM
  7. Sum with multiple conditions:SUMPRODUCT
    By will.00 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-06-2007, 03:51 AM

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