+ Reply to Thread
Results 1 to 11 of 11

USING COUNTIF to reference closed workbooks

  1. #1
    Registered User
    Join Date
    11-18-2014
    Location
    Sydney Australia
    MS-Off Ver
    Windows 7 professional
    Posts
    10

    USING COUNTIF to reference closed workbooks

    Hi All!

    I wish to dynamically upate a target workbook with references to a large number of source workbooks without having all the source workbooks open on my local PC. I have people on the phones working on anything up to 25 separate workbooks. I have created a target spreadsheet that functions as a dashboard and allows me to monitor “live” any changes made in any these workbooks. Most of my formulae are “COUNTIF” style formulae using “INDIRECT” and they work because all the source workbooks are shared and open on my local PC. In order to refresh the counts on my dashboard I have a macro that saves all open workbooks. How can I dynamically reference my source workbooks without them all being open on my local PC? Please note that some of the source workbooks might be closed but the majority will be open by other users.

    Thanks in advance.

    Regards

    Itzik

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

    Re: USING COUNTIF to reference closed workbooks

    You can use SUMPRODUCT.

    This style for COUNTIF:
    =SUMPRODUCT(--('C:\Users\Windows 8\Desktop\[Book3.xlsx]Sheet1'!$A$2:$A$10 =$A2))
    or this for SUMIF:
    =SUMPRODUCT(--('C:\Users\Windows 8\Desktop\[Book3.xlsx]Sheet1'!$A$2:$A$7=Sheet1!A2),'C:\Users\Windows 8\Desktop\[Book3.xlsx]Sheet1'!$B$2:$B$7)
    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

  3. #3
    Registered User
    Join Date
    11-18-2014
    Location
    Sydney Australia
    MS-Off Ver
    Windows 7 professional
    Posts
    10

    Re: USING COUNTIF to reference closed workbooks

    Thanks so much Glenn. I will play with this and let you know how I go. Regards, Itzik

  4. #4
    Registered User
    Join Date
    11-18-2014
    Location
    Sydney Australia
    MS-Off Ver
    Windows 7 professional
    Posts
    10

    Re: USING COUNTIF to reference closed workbooks

    Hi Glenn!

    Thanks. I have had some success so far with converting my simple "COUNTIF" formulae using your first formula. However I cannot figure out how to do the more complex countifs with sumproduct.

    If you could imagine a table where in column A you have ID numbers that describe regions. Numbers 1000000 to 1999999 are one region, 1200000 to 129999 are another etc. In Columns L and M you have call results - first call attempt in column L and second attempt in collumn M. Values in the results columns could be "NC" for no-contact, "G" for "Get" etc. When I wish to know how many calls in region #1 (<1200000) produced results either "G" or "SC" I have been using the following formula:

    =SUMPRODUCT(COUNTIFS(INDIRECT("'[Rejects "&$B$2&".xlsx]Metro'!$A:$A"),">1000000",INDIRECT("'[Rejects "&$B$2&".xlsx]Metro'!$A:$A"),"<1200000",INDIRECT("'[Rejects "&$B$2&".xlsx]Metro'!$L:$L"),{"g","sc"}))+SUMPRODUCT(COUNTIFS(INDIRECT("'[Rejects "&$B$2&".xlsx]Metro'!$A:$A"),">1000000",INDIRECT("'[Rejects "&$B$2&".xlsx]Metro'!$A:$A"),"<1200000",INDIRECT("'[Rejects "&$B$2&".xlsx]Metro'!$M:$M"),{"g","sc"})

    How can I adapt this so that it will work when the workbook is close?

    Thanks again for your willingness to help.
    Regards
    Itzik

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

    Re: USING COUNTIF to reference closed workbooks

    Is this the formula in its unaltered state, or one you've been trying to adjust?

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

    Re: USING COUNTIF to reference closed workbooks

    A word of caution - try and avoid using full-column ranges with SP, it will start to slow your file down, rather, use specific ranges.
    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

  7. #7
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: USING COUNTIF to reference closed workbooks

    It's not the SUMPRODUCT function that's referencing the entire columns, it's the COUNTIFS function.

    The COUNTIFS function can do this more efficiently.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

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

    Re: USING COUNTIF to reference closed workbooks

    Sorry, I must have been sleeping when I first looked at this. INDIRECT does NOT work on closed sheets. There is a free add-on (INDIRECT.EXT) that does work in currrent versions of Excel; but it MUST be installed on all PCs that will want to access closed files. By comparison with that - the use of SP on whole columns is of minor concern!!!

  9. #9
    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,139

    Re: USING COUNTIF to reference closed workbooks

    However, all is not/may not be all lost yet. Some years back, Harlan Grove wrote a UDF called PULL, which does the same thing as INDIRECT, but on closed sheets. I have modelled your set up and it seems to work OK. However my knowledge of VBA is woeful (at best) and I have no idea how to make the function auto-update!! CTRL-ALT-SHIFT-F9 will make it update. The formula is quite horrendous:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    but it works. See the formula in Book3 (macro-enabled) and the source data in Rejects12.
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    11-18-2014
    Location
    Sydney Australia
    MS-Off Ver
    Windows 7 professional
    Posts
    10

    Re: USING COUNTIF to reference closed workbooks

    Hi All!

    Firstly, Glenn, that was the original code before I tried (unsuccessfully) to modify it using Sumproduct. I posted it so you could see how I have been using countifs to manage the conditions and to show you the most common kind of task that I need my code to perform. If there is a way to achieve the same goal with closed workbooks using some other function such as sumproduct that would be ideal. But thanks so much for showing me how I could use Glen's "Pull" function for my formulae. I will study your examples, play with it a bit and see how I go.

    To all the others who have responded, thank you. Sadly, I am aware that INDIRECT does not work for closed workbooks. I have seen references to Harlan Groves' code (and to others who have also written massive vb code for INDIRECT) but figuring out the formulae for those codes is above my skill level at the moment.

    Again, thanks so much to all those who have invested time in my small problem.

    Regards

  11. #11
    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,139

    Re: USING COUNTIF to reference closed workbooks

    OK. let me know how it works out. I'll be a bit "thin on the ground" for a few days, but will look in from time to time.

+ 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. Reference Range from Closed Workbooks
    By icebreak22 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-13-2014, 09:33 AM
  2. Link to closed workbooks
    By Befuddled in forum Excel General
    Replies: 28
    Last Post: 07-24-2014, 05:59 AM
  3. Get Values from closed workbooks
    By Dgagea in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-09-2011, 09:47 AM
  4. Looking up values in a closed workbooks
    By walid66 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-10-2011, 12:49 AM
  5. Take Information from closed workbooks
    By Dave69rock in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-19-2010, 05:54 AM
  6. Summing from Closed Workbooks
    By ExcelTip in forum Tips and Tutorials
    Replies: 0
    Last Post: 08-28-2005, 11:03 AM
  7. I want to reference closed workbooks with combo boxes
    By Akira5284 in forum Excel General
    Replies: 1
    Last Post: 06-02-2005, 03: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