+ Reply to Thread
Results 1 to 8 of 8

SUMIF with Multiple Columns and rows?

  1. #1
    Registered User
    Join Date
    10-01-2015
    Location
    Dallas
    MS-Off Ver
    2013
    Posts
    31

    SUMIF with Multiple Columns and rows?

    Hi, I need a formula to sum an amount based on row and columns perimeters.

    I have the month-year in the columns (B3:Z3) and numbers in the rows (B12:B55), so the amounts are obviously in B12:Z55.

    Curve ball: I have a range of cells in the destination tab that contain the list of numbers to be summed for that particular category (T26:AA26).

    I need a formula that would sum all dollars for Feb 2018 for the numbers in range T26:AA26. So the reference range (T26:AA26) I would have entered the number 2 in T26 and the number 4 in U26. The formula would return 50.

    Jan 18 Feb 18 Mar 18 Apr 18
    1 40 5
    2 30 20
    3 10 5 20
    4 20 3 2

    This is the formula I have right now. The reference numbers I mentioned earlier are in T26:Z26. So the below formula manually adds those together, one by one. I would like to have one formula that will sum based on the numbers in T26:Z26. Something like "*"&T26:Z26&"*"?

    (Must press Cntrl+Shift+Enter)

    =SUM(IF('Revenue'!$B$12:$B$53=$T26, IF('Revenue'!$AA$7:$AQ$7=F$8, 'Revenue'!$AA$12:$AQ$53)))+
    SUM(IF('Revenue'!$B$12:$B$53=$U26, IF('Revenue'!$AA$7:$AQ$7=F$8, 'Revenue'!$AA$12:$AQ$53)))

  2. #2
    Forum Expert ben_hensel's Avatar
    Join Date
    01-26-2012
    Location
    Northeast USA
    MS-Off Ver
    Office 365
    Posts
    2,043

    Re: SUMIF with Multiple Columns and rows?

    I'm not really following your criteria here. Can you post an example spreadsheet?
    Click the [* Add Reputation] Button to thank people for help!
    Post Attachment: Click [Go Advanced] under the reply box; then click [Manage Attachments] to launch the attachments dialogue.
    Mark Thread Solved: Go to the top of the first post; Select [Thread Tools] dropdown; Pick the [Mark thread as Solved] option.

  3. #3
    Registered User
    Join Date
    10-01-2015
    Location
    Dallas
    MS-Off Ver
    2013
    Posts
    31

    Re: SUMIF with Multiple Columns and rows?

    Ok I think this works. Lookup Example.xlsx

    This is a very simplified worksheet. My data is much larger and I have more categories as well.

  4. #4
    Forum Expert ben_hensel's Avatar
    Join Date
    01-26-2012
    Location
    Northeast USA
    MS-Off Ver
    Office 365
    Posts
    2,043

    Re: SUMIF with Multiple Columns and rows?

    Try this in G4 of your example:

    Please Login or Register  to view this content.
    Still an array formula.

    Using OFFSET(MATCH) to pick how far over the column should be by the date; then running the array formula to create a Boolean square matrix of the data index vs. data codes.

  5. #5
    Registered User
    Join Date
    10-01-2015
    Location
    Dallas
    MS-Off Ver
    2013
    Posts
    31

    Re: SUMIF with Multiple Columns and rows?

    Genius! Any way I can exclude the blank values from being included in my sum? For example there are some rows in the matrix that have no number associated with them and instead of modifying the range in my lookup for each category I want to have it ignore the zeros or blanks in the data.

  6. #6
    Forum Expert ben_hensel's Avatar
    Join Date
    01-26-2012
    Location
    Northeast USA
    MS-Off Ver
    Office 365
    Posts
    2,043

    Re: SUMIF with Multiple Columns and rows?

    You mean Blank or zero values in the B4:F4 test ranges and the like?

    As long as you aren't using zero as an index for the "Data", then the test will deliver FALSE and exclude them anyway. Because 0 <> index_number.

  7. #7
    Registered User
    Join Date
    10-01-2015
    Location
    Dallas
    MS-Off Ver
    2013
    Posts
    31

    Re: SUMIF with Multiple Columns and rows?

    Hi Ben....I figured it out. I used the below modification and it worked. Thanks again for all your help.

    =SUM(IF(($H$10:$H$17=$B4:$F4)*($B4:$F4<>""), OFFSET($H$9, 1, MATCH($G$2,$I$9:$O$9, 0), ROWS($H$10:$H$17), 1), 0))

  8. #8
    Spammer
    Join Date
    01-08-2015
    Location
    Cali, Colombia
    MS-Off Ver
    365
    Posts
    302

    Re: SUMIF with Multiple Columns and rows?

    Hi, to both!

    Another option could be (NON-CSE):
    [G4] : =SUMPRODUCT(SUMIF(H$10:H$17,B4:F4,INDEX(I$10:O$17,,MATCH(G$2,I$9:O$9,))))
    or
    [G4] : =SUMPRODUCT((I$9:O$9=G$2)*COUNTIF(B4:F4,H$10:H$17)*I$10:O$17)
    And drag it down.

    Blessings!
    Last edited by johnmpl; 02-22-2018 at 07:00 PM.

+ 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. [SOLVED] Sumif or Sumproduct with Multiple Rows & Columns
    By lqorri in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-12-2017, 09:05 AM
  2. Sumif or Sumproduct with Multiple Rows & Columns
    By vulches in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 05-12-2017, 02:06 AM
  3. Can I used SUMIF or similar for columns & rows?
    By GermainM in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 03-01-2017, 10:22 AM
  4. [SOLVED] Conditional SUMIF based on multiple columns and multiple row variables
    By jaymaan74 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-15-2016, 11:05 AM
  5. Search Multiple Columns and Rows - Show results in Multiple columns and rows
    By heykeighley in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 08-12-2015, 10:16 AM
  6. [SOLVED] SUMIF across multiple columns and rows
    By GTretick in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 04-10-2015, 07:41 PM
  7. SUMIF with rows and columns
    By David Howdon in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-17-2005, 01:05 PM

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