xd9813
New Member
- Joined
- Mar 9, 2014
- Messages
- 7
- Office Version
- 365
- 2021
- Platform
- Windows
- Mobile
- Web
Objective:
Provide aggregate sales totals based on multiple criteria in Product Description column from >5K workbooks located within different folders & with different layouts, sheet names, and workbook names. However, all column names are similar (not 100% but close). The names of the workbooks are important as they have the contract name, fiscal year, fiscal quarter, & vendor name. The sales totals need to be grouped by based on the following variables:
Logic Flow:
Problem:
Step 3. SUMIFS() only works if workbooks are open, unlike the sum function. Using the SUM(IF()) is not useful as IF() does not accept wildcards and my product description criteria requires wildcards. In addition, when I trye to keep them all open, I get a run-time error 1004 after 100 odd workbooks. I can't close 'em and I can't leave 'em open.
Ask:
I am just seeking guidance with my logic flow. Is there are better logic flow than the one shown above? I should be able to figure out the code from the suggested logic flow.
Provide aggregate sales totals based on multiple criteria in Product Description column from >5K workbooks located within different folders & with different layouts, sheet names, and workbook names. However, all column names are similar (not 100% but close). The names of the workbooks are important as they have the contract name, fiscal year, fiscal quarter, & vendor name. The sales totals need to be grouped by based on the following variables:
- Contract Name
- Fiscal Year
- Fiscal Quarter
- Vendor Name
- Multiple Criteria in Product Description column (no fixed sheet, no fixed range)
Logic Flow:
- Open each workbook, get layout info (file name, sheet count, sheet names, product description range, & sales total range). If workbook file name does not follow convention, then rename the workbook to this format: [Contract Name]_FY[2 digit Fiscal Year]_Q[Fiscal Quarter]_[Vendor Name].xlsx
- Using the info above develop two-dimensional String arrays with the SUMIFS() function to include product description criteria & the appropriate ranges for total sales for each contract and Fiscal years
- Repeat steps 1 & 2 until all >5k workbooks are processed
- In a new workbook, type in references from the step 2. SUMIFS() results must be based on Contracts & Fiscal Quarters found in the workbook file names E.g. add total sales from Contract1_FY2013_Vendor1.xlsx, Contract1_FY2013_Vendor2.xlsx,Contract1_FY2013_Vendor3.xlsx, Contract1_FY2013_Vendor4.xlsx, etc.
- Close all workbooks
- Save this summary workbook
Problem:
Step 3. SUMIFS() only works if workbooks are open, unlike the sum function. Using the SUM(IF()) is not useful as IF() does not accept wildcards and my product description criteria requires wildcards. In addition, when I trye to keep them all open, I get a run-time error 1004 after 100 odd workbooks. I can't close 'em and I can't leave 'em open.
Ask:
I am just seeking guidance with my logic flow. Is there are better logic flow than the one shown above? I should be able to figure out the code from the suggested logic flow.
Last edited by a moderator: