+ Reply to Thread
Results 1 to 5 of 5

Code to filter Sub Array from data set

  1. #1
    Forum Contributor
    Join Date
    07-12-2015
    Location
    Dubai,UAE
    MS-Off Ver
    Office 365
    Posts
    447

    Code to filter Sub Array from data set

    Hi,

    Im trying to filter a subarray from a data set using 2 criteria.
    In the Data sheet I have the data and in cells G3 and G4, I have the criteria for company and marks which will be used to filter the data

    I require the simplest code to filter the data using the entered criteria and paste into a new sheet ( "Result") sheet

    I know how to do this using formula but require a VBA solution.

    Also would require an error control if entered criteria is not found in the data set.


    Thanks in advance.Sample sheet attached.
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    10-19-2012
    Location
    Omaha, Nebraska USA
    MS-Off Ver
    Excel 2010
    Posts
    249

    Re: Code to filter Sub Array from data set

    Hi,

    The attached workbook should do what you describe. Whenever you change the value in G3 or G4, it will update the "Result" sheet. The VBA code is "event enabled", so it runs automatically when the values in cells G3 or G4 change. If either of those cells is blank, it won't change anything. If the data input doesn't match any of the data in the table, it will give a message saying no data matches and will not provide a Result sheet.

    Hope that helps,

    Dan
    Attached Files Attached Files

  3. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Code to filter Sub Array from data set

    If you change the layouts of criteria range, it is much easier for AdvancedFilter and very fast.
    This is still using AdvancedFilter with a little twist.
    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    07-12-2015
    Location
    Dubai,UAE
    MS-Off Ver
    Office 365
    Posts
    447

    Re: Code to filter Sub Array from data set

    Quote Originally Posted by djbomaha View Post
    Hi,

    The attached workbook should do what you describe. Whenever you change the value in G3 or G4, it will update the "Result" sheet. The VBA code is "event enabled", so it runs automatically when the values in cells G3 or G4 change. If either of those cells is blank, it won't change anything. If the data input doesn't match any of the data in the table, it will give a message saying no data matches and will not provide a Result sheet.

    Hope that helps,

    Dan
    Thanks Dan for the help!!
    Exactly what I needed....

  5. #5
    Forum Contributor
    Join Date
    07-12-2015
    Location
    Dubai,UAE
    MS-Off Ver
    Office 365
    Posts
    447

    Re: Code to filter Sub Array from data set

    Quote Originally Posted by jindon View Post
    If you change the layouts of criteria range, it is much easier for AdvancedFilter and very fast.
    This is still using AdvancedFilter with a little twist.
    Please Login or Register  to view this content.
    Thanks jindon!!

+ 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] Filter Data with an Array Formula
    By myobreportguru in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-05-2016, 05:02 AM
  2. Cannot filter data that is part of an array
    By haulinbass in forum Excel General
    Replies: 1
    Last Post: 06-11-2016, 06:13 PM
  3. VBA Function to filter data from an array
    By car___ in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-19-2014, 04:31 PM
  4. [SOLVED] Filter data using Array Function
    By HaroonSid in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-23-2014, 08:45 AM
  5. [SOLVED] Filter Data with Array
    By jkj115 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 03-19-2013, 04:22 PM
  6. VBA code to filter data
    By Knigtandday in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-18-2013, 05:36 PM
  7. VBA code to filter data
    By Pelham in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-18-2006, 12:30 AM

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