+ Reply to Thread
Results 1 to 16 of 16

Function/Formula like SUMIFS to include Sheet name

  1. #1
    Registered User
    Join Date
    08-04-2014
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    37

    Function/Formula like SUMIFS to include Sheet name

    Hi,

    I have a number of templates which have been sent out to various people and need a SUMIFS formula on a Summary Totals sheet after I have compiled them all together into one workbook.

    Normally, I would just use the SUMIFS formula, however, because there are plenty of sheets to work with (after compiling all the templates into one worksheet), this would take a lot of effort and time to get this right.

    Is there a way to create a function similar to a SUMIFS but specifying sheet names that include a specific word? e.g. if there are 20 sheets and 3 of them include "..."Priority Total" I want to sum only the sheets that include "Priority Total" in the sheet name.

    Hope this makes sense.

  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
    44,054

    Re: Function/Formula like SUMIFS to include Sheet name

    Here's a "generic" SUMIF formula that collects data from the sheets in the named range "List":

    =SUMPRODUCT(SUMIF(INDIRECT("'"&List&"'!A1:A500"),A2,INDIRECT("'"&List&"'!B1:B500")))

    If you make a list of the sheets containing "Priority" and create a named range encompassing that list, you should be able to adapt this to your needs. If your need is for a sumifs... then change the syntax appropriately. Don't use whole column references, as this will slow your sheet down.
    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
    08-04-2014
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    37

    Re: Function/Formula like SUMIFS to include Sheet name

    Thanks for the quick response. Unfortunately, I can't seem to get this to work.

    In the named range, do I need to make a complete list of ALL sheet names? If so, I'm not sure this would be a viable solution for me as there would be a large number of sheets to go through.

    Another thing I should have mentioned is that I would also need to be able to sum the total of different sheet names, e.g. if someone wants to see the total of priority or non-priority (among other options) which they would select from a dropdown. I would also need to be able to see the total of ALL if required.

    I've tried to attach an example but can't seem to do so. Perhaps a SUMIFS wouldn't be required as the sum would be of the same cell in each sheet. Each sheet is a table with, let's say, a month in column B along with the total in column C. The "Total" sheet is the same table as the others.

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,207

    Re: Function/Formula like SUMIFS to include Sheet name

    Attach a sample workbook (not image).

    Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate.

    Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  5. #5
    Registered User
    Join Date
    08-04-2014
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    37

    Re: Function/Formula like SUMIFS to include Sheet name

    Hi

    I'm getting nothing when clicking the attach file icon in "Go Advanced". I see a "javascriptvoid('Attachments')" error. I've double checked and my browser allows for these scripts to run. I have a number of files uploaded when clicking on manage attachments.

    Essentially, I have (or will have as I'm still collating them) several templates which I need to consolidate together. Each template will have more than one sheet with a suffix or prefix of, let's say, priority and non-priority.
    The data will be in a table with months in cells C3:C14 and totals in cells E3:E14. The consolidated file has a summary tab with months in the same layout with an added dropdown above the data which has options priority/non-priority. If for example someone chooses priority from the dropdown, the formula in cell C3 of the summary sheet should be the sum of cell C3 from all sheets that have "priority" in the sheet name.

    Hope that explains the issue.

    I will have several sheets so going through each sheet or creating a list of each probably won't be the best way of solving the issue especially since I will be adding more sheets as the templates come in.

    Thanks for the help so far.

  6. #6
    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,054

    Re: Function/Formula like SUMIFS to include Sheet name

    You haven't followed the instructions...



    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.

  7. #7
    Registered User
    Join Date
    08-04-2014
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    37

    Re: Function/Formula like SUMIFS to include Sheet name

    I've managed to attach the file.

    I've got 2 VBA modules which I found online but have no idea how to use them
    Attached Files Attached Files

  8. #8
    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,054

    Re: Function/Formula like SUMIFS to include Sheet name

    Macros removed. See sheet. happy to explain. I created some additional named ranges.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    08-04-2014
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    37

    Re: Function/Formula like SUMIFS to include Sheet name

    Quote Originally Posted by Glenn Kennedy View Post
    Macros removed. See sheet. happy to explain. I created some additional named ranges.
    Hi Glenn,

    Works great. However, I'm wondering whether there might be a solution where I don't have to add sheet names tot he named range as there will be several more templates coming in.

    If not, I'll just have to add the sheet names as they come in.

    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,054

    Re: Function/Formula like SUMIFS to include Sheet name

    Will the sheets be called XXX Priority or XXX non-priority, or can they be all sorts of things. can you be more explicit about sheet naming....

  11. #11
    Registered User
    Join Date
    08-04-2014
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    37

    Re: Function/Formula like SUMIFS to include Sheet name

    Quote Originally Posted by Glenn Kennedy View Post
    Will the sheets be called XXX Priority or XXX non-priority, or can they be all sorts of things. can you be more explicit about sheet naming....
    Hi Glenn,

    At the moment, they have been coming in xxx non-priority/priority.

  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,054

    Re: Function/Formula like SUMIFS to include Sheet name

    OK. Here we go. You will see that this is an .xlsm. I used an old inbuilt Excel 4.0 macroto help me return a list of all the sheetnames in the file. The formula in Lists column A and the Named Range GetLists do that bit.

    I then used some formulae to derive 3 lists in the Table in columns C-E of Lists. The first two separate Priority and non-priority and the third combines them to facilitate the "All" Option. I tried running "All" off the list of sheetnames, but I couldn't persuade it to work for me!!

    to support the final formula, I had to create a series of Named ranges. You know where to find these. If you need any of these explained further, shout. that said, this one is the bit that does all the heavy lifting. It locates the exact range corresponding to "All", "Priority", etc.

    =INDEX(TBL,1,MATCH(Type,TBL[#Headers],0)):INDEX(TBL,SUMPRODUCT(--(LEN(INDEX(TBL,,Col))>0)),MATCH(Type,TBL[#Headers],0))

    If you want to see it work, paste it and array enter it in a cell and then use formulas/evaluate formula to watch it step through...

    You're lucky. I tried to do something similar to this a week or so back... and failed. Over two or three sessions today, I finally got it to work!!

    oh, and I simplified the sumproduct formula, to take advantage of the fact that your sheets were identical in layout.

    So, hopefully, that's it.
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    08-04-2014
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    37

    Re: Function/Formula like SUMIFS to include Sheet name

    Great stuff . Thanks again.

    I'll give it a go and let you know how it goes.

  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,054

    Re: Function/Formula like SUMIFS to include Sheet name

    Please do...

  15. #15
    Registered User
    Join Date
    08-04-2014
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    37

    Re: Function/Formula like SUMIFS to include Sheet name

    Hi Glenn

    Perfect. Not sure how the Get.Workbooks bit works (not VBA/Macro savvy just yet) but I can work with this. I'll be saving this for future as I know it will come in handy at some point again.


    Thanks for all your help and solving the issue for me.

  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,054

    Re: Function/Formula like SUMIFS to include Sheet name

    You're welcome.



    If that takes care of your original question, please select "Thread Tools" from the menu link above and mark this thread as SOLVED.

    It'd also be appreciated if you were to click the Add Reputation button at the foot of any of the posts of all members who helped you reach a solution.

+ 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: 2
    Last Post: 11-28-2017, 02:04 AM
  2. [SOLVED] Include and exclude items using SUMIFS and wildcards
    By Luis Ah-Hoy Jr. in forum Excel General
    Replies: 10
    Last Post: 03-16-2017, 03:33 PM
  3. Replies: 1
    Last Post: 11-22-2016, 01:54 AM
  4. sumifs include/ include criteria
    By Burt_100 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-14-2016, 07:34 AM
  5. Trying to include "Blank Cells" in a SUMIFS formula
    By KomicJ in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-28-2015, 11:47 PM
  6. [SOLVED] Using SUMIFS but criteria also include all
    By davidfromkent in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 10-22-2015, 07:42 AM
  7. Is it possible to include two sumifs statements into one function?
    By VBAhelp3456 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-01-2015, 04:36 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