+ Reply to Thread
Results 1 to 19 of 19

Suming a table total based on Defined Name and month

  1. #1
    Registered User
    Join Date
    12-03-2012
    Location
    Perth
    MS-Off Ver
    Excel 2010
    Posts
    19

    Suming a table total based on Defined Name and month

    Hi
    As per attached workbook, I would like an Excel formula to pick up a group of account number from a defined name and add all the amounts for a particular month.

    There will be a number of defined names which could more than 10 different account numbers.

    In the example:
    Defined Name Relates to Account
    Acct1 5000, 5100 and 5300

    The month required is for May
    So the total is 195 + 205 + 225 = 625

    Thanks.
    Attached Files Attached Files

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

    Re: Suming a table total based on Defined Name and month

    Try below array formula

    =SUMPRODUCT(($A$3:$A$15=TRANSPOSE(Acct1))*INDEX($B$3:$M$15,,MATCH(C19,$B$2:$M$2,0)))

    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.
    Samba

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

  3. #3
    Registered User
    Join Date
    12-03-2012
    Location
    Perth
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Suming a table total based on Defined Name and month

    Thanks Samba

  4. #4
    Registered User
    Join Date
    12-03-2012
    Location
    Perth
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Suming a table total based on Defined Name and month

    Hi Samba
    Continuing from the above, is it possible to get a total for the for Acct1 from Jan to May?

    So the total for Acct1 will be total of the followings:
    Account# 5000 = 115+135+155+175+195
    Account# 5100 = 125+145+165+185+205
    Account# 5200 = 145+165+185+205+225

    So the total for Acct1 is 2525
    The total for Accnt1 will need to base on the Account numbers in Acct1 and the Month (total of all the month before and including current month).

    Thanks.

  5. #5
    Registered User
    Join Date
    12-03-2012
    Location
    Perth
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Suming a table total based on Defined Name and month

    Hi Samba
    I am also having issues with using indirect (reference to another workbook) with =SUMPRODUCT(($A$3:$A$15=TRANSPOSE(Acct1))*INDEX($B$3:$M$15,,MATCH(C19,$B$2:$M$2,0)))

    Thanks.

  6. #6
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,542

    Re: Suming a table total based on Defined Name and month

    I imagine that you are hoping to get a one formula solution for for question posted in #4 and perhaps someone will come up with one. Until then this might help.
    A helper column (XFD) is populated using:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Note that cells C19:D19 are populated with Jan and May respectively.
    Cell D24 displays the sum using: =SUM(XFD3:XFD15)
    Let us know if you have any questions.
    Attached Files Attached Files
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  7. #7
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Suming a table total based on Defined Name and month

    This would be one way.
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    But this requires the constants "Jan" and "May" typed in. Will need to modify formula to reference cells with month names to make this more robust.
    Dave

  8. #8
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,542

    Re: Suming a table total based on Defined Name and month

    @ Dave, That is one Nice Formula!
    Using the formula that Dave provided I was able to get correct results by replacing "Jan" and "May" with references to the cells C19 and D19 as modeled in the file attached to post #6.
    Let us know if you have any questions.

  9. #9
    Registered User
    Join Date
    12-03-2012
    Location
    Perth
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Suming a table total based on Defined Name and month

    JeteMc and FlameRetired, thank you very much it worked perfectly. I could also change the starting month and it still works, that was what I was looking for.

    Any idea how to use indirect (to reference to another workbook) with this formula? I have tried many combination and still unable to get it working.
    =SUMPRODUCT(($A$3:$A$15=TRANSPOSE(Acct1))*INDEX($B$3:$M$15,,MATCH(C19,$B$2:$M$2,0)))

    Thanks.

  10. #10
    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
    44,000

    Re: Suming a table total based on Defined Name and month

    Will the other workbook be open? INDIRECT only works with OPEN files.
    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

  11. #11
    Registered User
    Join Date
    12-03-2012
    Location
    Perth
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Suming a table total based on Defined Name and month

    Glenn
    Yes the workbook will be open.

    If there is a better alternative instead of using indirect with another workbook, I will look at it as well.

    I want to create one workbook where every month I will dump the monthly raw data into. There are four to six worksheets with raw data in this work book all from different sources.

    I have a few other workbooks which produces different reports every month and extracting the raw data from the above workbook.

    So by using indirect all the workbooks have to be opened.

    Thanks.

  12. #12
    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
    44,000

    Re: Suming a table total based on Defined Name and month

    I missed your reply. You haven't provided enough info for a decent reply.

    However, instead of:

    SUMPRODUCT($G$3:$G$6)…...

    you'll need:
    SUMPRODUCT(([Filename.xlsx]Sheet1!$G$3:$G$6)…...
    to refer to another file

    If it's the filename that you're picking up from another cell, then you'll need:

    SUMPRODUCT((indirect("'["&A1&".xlsx]Sheet1'!$G$3:$G$6"))…...

  13. #13
    Registered User
    Join Date
    12-03-2012
    Location
    Perth
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Suming a table total based on Defined Name and month

    Hi Glenn
    I forgot to mention I know how to use Indirect, I use it to reference to a workbook and worksheet, but I am not sure how to combine
    =INDIRECT("'[" & $C$2 & "]" & $C$3 & "'!" & ####)
    =SUMPRODUCT(($A$3:$A$15=TRANSPOSE(Acct1))*INDEX($B$3:$M$15,,MATCH(C19,$B$2:$M$2,0)))
    Note: #### can be replaced with formula or cell reference

    I have tried putting indirect just after the sumproduct, just before transpose, before and after index, but unable to get it to work.

    Any help will be great.

    Thanks.

  14. #14
    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
    44,000

    Re: Suming a table total based on Defined Name and month

    Where do you want to combine them? What part of the SP do you want to replace??? Without seeing a sample sheet, I don't really know what you're attempting to do...

    Will you please attach a SMALL sample Excel workbook (10-20 rows of data is usually enough)? Please don't attach a picture of one (no-one will want to re-type all your stuff before starting).

    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.

  15. #15
    Registered User
    Join Date
    12-03-2012
    Location
    Perth
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Suming a table total based on Defined Name and month

    Hi Glenn
    I have attached 2 workbooks. Save both workbooks on your computer and then open both workbooks.

    Book1.xlsx
    It has a table
    3 different formulas:
    - 1 is a simple sum formula
    - 1 is a sum range of months based on certain accounts
    - 1 is a month based on certain accounts

    Book2.xlsx
    Using indirect to refer to book1.xlsx table

    I want to be able to use all 3 formulas to reference to book1.xlsx

    The simple sum formula is in A8 and A9, which works.

    The other 2 formulas I am not sure how to use indirect with the formulas

    Is there a better way to use indirect in Book2.xlsx, currently I list the source workbook name and worksheet in B4 and B5.

    Thanks.
    Attached Files Attached Files

  16. #16
    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
    44,000

    Re: Suming a table total based on Defined Name and month

    See file.

    The named range won't work. replaced by a fixed range.

    Use of INDIRECT within TRANSPOSE requires that formula is entered as an array formula.

    You had me totally confused for ages.... Your final formula referred to C19 (july), but the expected result was for december (E19)....
    Attached Files Attached Files

  17. #17
    Registered User
    Join Date
    12-03-2012
    Location
    Perth
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Suming a table total based on Defined Name and month

    Hi Glenn
    Thank you very much for the quick reply. That is what I was looking for.

    Over here our financial year starts in July and ends in June the following year. Apologies for the confusion.

    Is this an efficient way to use indirect reference with the "source"? Or is there a better way to use indirect reference?

    Thanks.

  18. #18
    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
    44,000

    Re: Suming a table total based on Defined Name and month

    Is the plan to have multiple files with multiple sheets all open at once? Do you intend to use book 2 with dropdowns to select specific sheet:file combinations quickly?

  19. #19
    Registered User
    Join Date
    12-03-2012
    Location
    Perth
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Suming a table total based on Defined Name and month

    I prefer something simple and quick. So if I can, open only one workbook with multiple worksheets and extract the data from another workbook (not open) that will be great.

    I won't be using a drop down to select specific workbook or sheet. The reason for having the "source" option with the workbook name and sheet name is that every year, i will create a new workbooks, eg. new worbook for book1.xlsx and book2.xlsx

    I think for me to use reference from one workbook to another workbook, I have to use indirect and open all workbooks as a requirement for indirect to work.

    I think there is another option is to use vba, which I do not have any knowledge of.

    If there is a better option I like to explore as well.

    Thanks.

+ 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] Suming top value - 80% of Grand total
    By srglt332 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-30-2020, 01:32 PM
  2. [SOLVED] Calculate a YTD Total based on Reporting Month and Week of Month via drop down selections
    By Miskondukt in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-02-2018, 05:14 PM
  3. Replies: 5
    Last Post: 12-08-2016, 04:24 AM
  4. Month Sum Total - Pivot Table
    By domgilberto in forum Excel General
    Replies: 1
    Last Post: 03-23-2015, 08:56 AM
  5. [SOLVED] Listing months in columns based on user defined start month
    By mashley in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-24-2014, 01:31 PM
  6. SUMPRODUCT with DATEIF totalling over 90 days
    By tougat1 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 08-23-2012, 02:02 PM
  7. Table based on defined name, change defined name, how?
    By Dubrock in forum Excel General
    Replies: 0
    Last Post: 06-27-2012, 09:20 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