+ Reply to Thread
Results 1 to 8 of 8

VBA formula with multiple variables to pull data from spread sheet.

  1. #1
    Registered User
    Join Date
    08-19-2006
    Location
    New York, NY
    MS-Off Ver
    MS Office 2013
    Posts
    33

    VBA formula with multiple variables to pull data from spread sheet.

    I have a large data base at work (about 28,000 rows) and I am trying to assign categories to some of the data that match a particular criteria. I wrote a simple VBA code to do this. Here is example of the code.

    Please Login or Register  to view this content.
    My problem is the code is returning data that is not included in my code. I don't know what I am doing wrong.

    Attached is a copy of code and workbook.

    Thanks for you help.
    Attached Files Attached Files

  2. #2
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: VBA formula with multiple variables to pull data from spread sheet.

    WHat is it doing wrong? I looked at it briefly and it looks like it's populating the columns BK, BL and BM with the proper info as per your macro.
    Happy with my advice? Click on the * reputation button below

  3. #3
    Registered User
    Join Date
    08-19-2006
    Location
    New York, NY
    MS-Off Ver
    MS Office 2013
    Posts
    33

    Re: VBA formula with multiple variables to pull data from spread sheet.

    I want to pull data with text "A708" in column C, but if you look at the results it is pulling data that matches "A162", "A703" and so on.

  4. #4
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: VBA formula with multiple variables to pull data from spread sheet.

    Yep that's because your code has an OR in it that searches column A for "A00070" and if you look at where its activating the macro for your A162 and A703 in column C you'll see that there is an A00070 in column A in these instances

  5. #5
    Registered User
    Join Date
    08-19-2006
    Location
    New York, NY
    MS-Off Ver
    MS Office 2013
    Posts
    33

    Re: VBA formula with multiple variables to pull data from spread sheet.

    Ok, I get it so what I am trying to get the code to do is

    Add a category if column 3 is = "A708" and column 13 is "02t1061000" and if column 1 = "A00070" or "A00080" or "A5550100." All three criteria has to be present. How do I write that?

  6. #6
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: VBA formula with multiple variables to pull data from spread sheet.

    try this

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    08-19-2006
    Location
    New York, NY
    MS-Off Ver
    MS Office 2013
    Posts
    33

    Re: VBA formula with multiple variables to pull data from spread sheet.

    Perfect!!!!!!!!!

    Thank you!!!!!!!!!!

  8. #8
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: VBA formula with multiple variables to pull data from spread sheet.

    no problem. you should mark as solved if there's no further issues

+ 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. Help pull data from a cell in another sheet compiled from three cell variables
    By photodotexe in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-01-2014, 09:30 AM
  2. Need help in creating a macro that will pull data from 1 spread to another
    By jwright77 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-01-2012, 08:03 AM
  3. [SOLVED] Need to pull 800 rows of data from a spread sheet at one time
    By jmorris462 in forum Excel General
    Replies: 3
    Last Post: 05-24-2012, 11:42 AM
  4. [SOLVED] Need to pull multiple reference points into one spread sheet
    By oniete1997 in forum Excel General
    Replies: 10
    Last Post: 04-05-2012, 10:18 PM
  5. Excel 2007 : Pull data from multiple sheet
    By cmsileo in forum Excel General
    Replies: 5
    Last Post: 12-08-2010, 02:56 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