+ Reply to Thread
Results 1 to 8 of 8

formula /vba to find Records Matching single / multiple Search Criteria in a workbook

  1. #1
    Forum Contributor
    Join Date
    02-11-2014
    Location
    mauritius
    MS-Off Ver
    MS365
    Posts
    1,086

    formula /vba to find Records Matching single / multiple Search Criteria in a workbook

    Hi All

    Need help, have a database with 2 worksheets 2014,2015 up 40000 rows in a workbook.
    In same workbook there is is a query sheet with specific criteria headers of 2014,2015.
    Not all headers of 2014 & 2015 are required in the query sheets .

    Need an efficient formula or vba to find records that match single or multiple criteria in COLUMN B with the the no of counts of records in query sheet

    see annexed as sample

    Can anyone help me

    thanks
    Attached Files Attached Files

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: formula /vba to find Records Matching single / multiple Search Criteria in a workbook

    1) I corrected the name of your Query Sheet to remove the hidden space at the end
    2) The macro will only import from sheets that are named Database ????, the word "Database" is the key

    This is filter code:
    Please Login or Register  to view this content.
    Attached Files Attached Files
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    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,939

    Re: formula /vba to find Records Matching single / multiple Search Criteria in a workbook

    Hopefully I understood what you wanted.

    Try this in C2, copied down...
    =IF(B2="","",COUNTIF(INDIRECT("'Database "&M2&"'!$A$2:$A$20"),'Query Sheet '!B2))

    If that was not what you wanted, please provide additional sample data, and a few more sample answers
    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

  4. #4
    Forum Contributor
    Join Date
    02-11-2014
    Location
    mauritius
    MS-Off Ver
    MS365
    Posts
    1,086

    Re: formula /vba to find Records Matching single / multiple Search Criteria in a workbook

    Hi Ford

    Just to be more explicit , when I put data in query sheet column A ITEMNO E.G '0000513, then the formula should look in database 2014 and 2015 and put the respective data in columns F TO M according to their headers as per previous attachments .

    when I look for another search in query say 0000537 it will list their respective headers F TO M again according to database 2014 &2015 and also give the no of counts found in database 2014 and 2015.

    The list has been shortened for ease and note the database may be unsorted .

    Hope it helps

  5. #5
    Forum Contributor
    Join Date
    02-11-2014
    Location
    mauritius
    MS-Off Ver
    MS365
    Posts
    1,086

    Re: formula /vba to find Records Matching single / multiple Search Criteria in a workbook

    Thank you a lot it works marvelously.

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

    Re: formula /vba to find Records Matching single / multiple Search Criteria in a workbook

    Quote Originally Posted by JEAN1972 View Post
    Thank you a lot it works marvelously.
    Out of curiosity, which 1 worked for you?

  7. #7
    Forum Contributor
    Join Date
    02-11-2014
    Location
    mauritius
    MS-Off Ver
    MS365
    Posts
    1,086

    Re: formula /vba to find Records Matching single / multiple Search Criteria in a workbook

    that of JBEAUCAIRE worked.

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: formula /vba to find Records Matching single / multiple Search Criteria in a workbook

    Glad to hear. If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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. Userform - search database for matching records, find next if more than one record
    By beaterfred in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-02-2012, 11:56 AM
  2. insert data from child workbook to master workbook by search matching records
    By jjgal767 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-21-2011, 05:10 AM
  3. Get multiple search criteria records
    By efernandes67 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-20-2010, 11:14 AM
  4. [SOLVED] return multiple records matching multiple criteria
    By Karthik in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-22-2006, 12:45 PM
  5. Extract multiple records matching criteria from list
    By William DeLeo in forum Excel Formulas & Functions
    Replies: 56
    Last Post: 09-06-2005, 12: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