+ Reply to Thread
Results 1 to 4 of 4

VBA Code for Index Match (multiple criteria) on Customer Data Sheet - Data Enrichment

  1. #1
    Registered User
    Join Date
    03-15-2017
    Location
    New York, NY
    MS-Off Ver
    MS Office 2016
    Posts
    2

    Exclamation VBA Code for Index Match (multiple criteria) on Customer Data Sheet - Data Enrichment

    Hi All,
    First time poster beginner/intermediate vba coder. I've used userforms and input boxes in the past to build financial models but nothing like what I'm trying to do now.

    Situation:
    I have a large Master Data File ~25mb excel file that uses an AFO to pulls customer information from a SAP BI system.
    This information included in columns are:

    Account # (Unique ID)
    Account Name
    Street Address
    Postal Code
    State
    Customer Hierarchy Level (CHL) information
    1
    2
    3
    4
    5


    Then on the right I have manually manipulated cells that depend on other worksheets to get the proper values.

    The key columns include:

    Zone
    District
    Group
    Sub-group
    Buying Consortium
    Local/ND
    Buying Consortium #
    Buying Consortium GROUP
    Buying Consortium Sub-GROUP
    NEW Buying Consortium #
    Joined Buying Consortium
    Left Buying Consortium


    Now the purpose of this excel sheet is to make quicker changes at the customer level to reflect reporting. I'm desperately looking for concise and quick VBA code that would be able to perform all of the manual manipulations based on an already set criteria.

    I'm first starting small and trying to create a VBA script, initiated by buttons in a userform (can think of ui later), that would find the next blank cell in columns [Zone] and [District] using a reference sheet or workbook (whichever would be faster).

    The next idea would be the same for the other columns; however, the other columns may need multiple MATCH criteria but lets start with the easy one first. [Zone] and [District]. I have the following syntax from a macro but this would slow down the workbook its huge like 20mb.


    Please Login or Register  to view this content.

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: VBA Code for Index Match (multiple criteria) on Customer Data Sheet - Data Enrichment

    Attach a sample workbook. 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.
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Registered User
    Join Date
    03-15-2017
    Location
    New York, NY
    MS-Off Ver
    MS Office 2016
    Posts
    2

    Wink Re: VBA Code for Index Match (multiple criteria) on Customer Data Sheet - Data Enrichment

    Hi dflak,
    Thanks for your response!!

    So I attached a before and after. This file mind you is very large and at times slow due to the front-end formulas.

    I can supply (De-sensitized) reference files if needed. Once you get passed[Zone] and [District] the logic becomes very complicated.

    I think once we have a fast VBA script rather than a clunky MACRO script for the postal code - [Zone] and [District] then I can use that for the other fields.

    Best Regards and Warm Wishes!
    Attached Files Attached Files

  4. #4
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: VBA Code for Index Match (multiple criteria) on Customer Data Sheet - Data Enrichment

    Let me guess at how you are getting this report. You click a button on the BI tool and it writes the Excel file for you. I work with a similar system. However our IT department has made a shadow database against which we can write SQL statements. I use MS-Query to import this data from the database directly into Excel. Most organizations are not set up to do this.

    So I am going to suggest a second best strategy. Can you have your IT department download the report automatically each day (or whatever) to a specific directory in CSV format? I can coach you through setting up MS-Query to read this CSV file. I can even provide some code so that if the file has a different name each day (due to a date stamp), that will change the connection string so you always access the latest downloaded file.

    One of the benefits of MS-Query is that it imports data into Excel tables. The import mechanism clears out the old data and imports the new data into the table. Tables "remember" formulas, formats and validations associated with them and copy them down automatically. So all the columns from AD on can have validations or VLOOKUP formulas. I don't see any out there right now.

    I can also coach you through setting up the report to run automatically using the task scheduler.

    So here is a potential scenario: Your IT department downloads the CSV file to the directory at 2 AM. Your report kicks off at 5 AM. You come to work in the morning, open up the report and start filling it in.

    Do you think such a setup would be possible in your organization and will you be willing to learn MS-Query and the Windows Task Scheduler?

    Second best is that they mail you the report in CSV format and you save it to a specific directory. Third best is you download the report as a CSV file manually. Fourth best is to work with what you have now, but I'll need more definition about what is supposed to go in columns AD onward. So far it all looks like manual entry to me and I can only guess at what data validation you need.

    The BI tool should have the capability to do both a download and mailing. Whether your IT people will do it depends on corporate policy.

    Importing data will still take some time, however, it will eliminate a lot of VB code. You may need some scraps of VB code to tie things together.

    Let me know how you would like to proceed.

+ 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] Multiple Criteria lookup to extract data from a dump - INDEX MATCH????
    By Rossovich in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-30-2016, 01:14 PM
  2. VBA code for combined sumif index/match for multiple criteria
    By megaheinz in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-16-2016, 11:44 AM
  3. [SOLVED] Index Match with multiple criteria - Return top sellers for certain week from year data
    By albanhac in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-12-2016, 06:28 AM
  4. Sumproduct or Index, Match to list data from another sheet meeting criteria
    By teststrip in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-10-2015, 10:01 PM
  5. [SOLVED] Index Match with multiple criteria and selecting data from a large table
    By Aquarock in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-14-2014, 09:26 PM
  6. [SOLVED] INDEX, MATCH: multiple criteria with iterative data
    By boai in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-05-2013, 06:43 AM
  7. Replies: 5
    Last Post: 01-05-2011, 03:13 PM

Tags for this Thread

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