+ Reply to Thread
Results 1 to 4 of 4

VBA to countif across multiple workbooks

  1. #1
    Registered User
    Join Date
    09-17-2021
    Location
    Rhode Island, USA
    MS-Off Ver
    Office 365
    Posts
    1

    VBA to countif across multiple workbooks

    I need to run a countif across 520 separate workbooks that each have ~80,000 lines of data. I want to count each workbook individually in a master datasheet. Any tips on how to do this?

  2. #2
    Registered User
    Join Date
    06-02-2018
    Location
    Italy
    MS-Off Ver
    2013-2019
    Posts
    31

    Re: VBA to countif across multiple workbooks

    There is not much to say, you have to open every single folder, count the lines and write the value back to the master.

  3. #3
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: VBA to countif across multiple workbooks

    If every workbook is in one folder a macro like this could loop through every file in that folder and preform some action on it. Does every workbook contain only one sheet or are there several sheets in the workbook?

    A macro like this will open every excel file in a folder:

    Please Login or Register  to view this content.
    But you must give more specific information, upload a small sample file and show what data should be extracted to master file if you wish for specific help.

    Alf

  4. #4
    Valued Forum Contributor
    Join Date
    11-04-2018
    Location
    Denpasar
    MS-Off Ver
    Excel 2010
    Posts
    777

    Re: VBA to countif across multiple workbooks

    Not exactly the answer for you,
    but maybe you want to have a look the code below :

    Please Login or Register  to view this content.
    The code assumed :
    - the 500 workbooks to be CountIf are in drive D, folder test ---> D:\test
    - the range of the criteria to be CountIf from those 500 workbook is always the same, which is cell A2 to cell A500000
    - the sheet name of that range is always the same, which is Sheet1
    - the criteria to be CountIf is "blablabla"
    - the active sheet when run the macro is completely blank

    The result will be listed in the active sheet start from cell B2 telling something like this on each row :
    workbook1.xlsx has blablabla 10 times
    workbook2.xlsx has blablabla 6 times
    workbook3.xlsx has blablabla 23 times
    and so on.
    Last edited by karmapala; 09-20-2021 at 07:00 AM.

+ 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. Macro to Pull Data from Multiple Workbooks to One Master Workbooks
    By eranajoy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-23-2019, 09:24 AM
  2. Sum & Countif from Multiple workbooks
    By SeanBigger in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-27-2019, 09:32 AM
  3. [SOLVED] countif across workbooks
    By bimo in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-25-2014, 09:54 AM
  4. Countif multiple criteria across workbooks
    By Lizziesdj in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-08-2013, 06:53 AM
  5. [SOLVED] Countif across workbooks
    By vivekmartin in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 06-13-2013, 01:24 PM
  6. [SOLVED] Open Multiple Workbooks, Record names, Copy paste to Active Workbook, Close the Workbooks
    By vba_madness in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-24-2013, 06:09 AM
  7. Countif between two workbooks!
    By RadioX in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-22-2012, 01:42 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