+ Reply to Thread
Results 1 to 7 of 7

Sum with Two Dimensional lookup

  1. #1
    Registered User
    Join Date
    04-30-2015
    Location
    Vancouver
    MS-Off Ver
    2010
    Posts
    2

    Sum with Two Dimensional lookup

    Hi,

    In the attached workbook ("Summary" tab) I am trying to get a sum of all values for a particular department (given in column C) and for a particular month ("Data-Detail" tab, Row # 2). When you open the file, it will be easier to understand what I need by looking at the table to populate.

    I have tried everything from sumifs, sumproduct but haven't been able to get anything. Any help will be highly appreciated.

    Thanks,
    Syed
    Attached Files Attached Files

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,942

    Re: Sum with Two Dimensional lookup

    Try this, copied down and across...
    =SUMPRODUCT((TEXT('Data-Detail'!$C$2:$AM$2,"mmmm")=Summary!D$2)*('Data-Detail'!$B$4:$B$60=Summary!$C3)*('Data-Detail'!$C$4:$AM$60))
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    04-30-2015
    Location
    Vancouver
    MS-Off Ver
    2010
    Posts
    2

    Re: Sum with Two Dimensional lookup

    Thank you! It is working. Now all I need to do is to understand this formula for future use. Thanks again!

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,942

    Re: Sum with Two Dimensional lookup

    Its actually pretty simple when you break it down

    =SUMPRODUCT((TEXT('Data-Detail'!$C$2:$AM$2,"mmmm")=Summary!D$2)*('Data-Detail'!$B$4:$B$60=Summary!$C3)*('Data-Detail'!$C$4:$AM$60))
    The 1st part is converting the dates in 'Data-Detail'!$C$2:$AM$2 to month names, using TEXT('Data-Detail'!$C$2:$AM$2,"mmmm") and then comparing it to Summary!D$2)
    This gives us the columns to use

    the 2nd part ID's the row to use...
    'Data-Detail'!$B$4:$B$60=Summary!$C3

    Those 2, together, give us the range we are interested in.

    the final part gives the entire range that we are working with...
    'Data-Detail'!$C$4:$AM$60

    So, it says (for January)....
    find the columns in the range 'Data-Detail'!$C$2:$AM$2 that = January and find the row in the range 'Data-Detail'!$B$4:$B$60 that = IDL 530 - Variance $ and then add up all the values in the entire range of 'Data-Detail'!$C$4:$AM$60 that falls in that range of columns and row

  5. #5
    Valued Forum Contributor
    Join Date
    05-20-2013
    Location
    Ohio, USA
    MS-Off Ver
    Excel 2013
    Posts
    941

    Re: Sum with Two Dimensional lookup

    Here's another option for D3, copied down and right...

    =SUMIFS(INDIRECT("'Data-Detail'!"&ROW()*5-4&":"&ROW()*5-4),'Data-Detail'!$2:$2,">="&Summary!D$2,'Data-Detail'!$2:$2,"<="&EOMONTH(Summary!D$2,0))

    ...and for D14, copied down and right...

    =SUMIFS(INDIRECT("'Data-Detail'!"&ROW()*5+14&":"&ROW()*5+14),'Data-Detail'!$2:$2,">="&Summary!D$2,'Data-Detail'!$2:$2,"<="&EOMONTH(Summary!D$2,0))

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,942

    Re: Sum with Two Dimensional lookup

    Nice, jhren I thought about doing indirect and/or offset, but was trying to avoid the obvious volatile formulas ( I know, SP is vloatile as well)

  7. #7
    Valued Forum Contributor
    Join Date
    05-20-2013
    Location
    Ohio, USA
    MS-Off Ver
    Excel 2013
    Posts
    941

    Re: Sum with Two Dimensional lookup

    Ohh! I forgot to mention that I changed summary headers to an actual date (e.g. 1/1/15 for January), displaying just the month, and filling right, incremented by 1 month. Otherwise my formulas won't work unless changed to resemble the TEXT part of yours...

+ 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] Three dimensional lookup???
    By rajncajn in forum Excel Formulas & Functions
    Replies: 22
    Last Post: 05-31-2012, 12:53 PM
  2. Two-dimensional lookup
    By ben803 in forum Excel General
    Replies: 2
    Last Post: 02-09-2011, 06:12 PM
  3. 2 dimensional lookup
    By vamshi57 in forum Excel General
    Replies: 8
    Last Post: 01-09-2011, 07:11 AM
  4. Two Dimensional Lookup
    By Swastik Banerje in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-19-2009, 12:57 PM
  5. [SOLVED] Two dimensional lookup
    By CDog in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 11-24-2005, 04:00 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