+ Reply to Thread
Results 1 to 8 of 8

VBA Filter Array by Two date Criterias, Help!

  1. #1
    Registered User
    Join Date
    04-17-2011
    Location
    Orlando
    MS-Off Ver
    Excel 2007
    Posts
    27

    VBA Filter Array by Two date Criterias, Help!

    Hello All,

    I have an array with four columns of projects with start dates and end dates.
    I am trying to create a user forum that generates a report based on the criteria of the Start and End date.

    Can someone help me filter the array based on the two Criteria’s??

    Example

    Start Date (Column A)---Company Name(Column B)---Project Name(Column C)---End Date(Column D)
    ------12/01/2011------------------Company 1-----------------------Project 1--------------------12/05/2011
    ------12/05/2011------------------Company 2-----------------------Project 2--------------------12/10/2011
    ------12/10/2011------------------Company 3-----------------------Project 3--------------------12/15/2011
    ------12/15/2011------------------Company 4-----------------------Project 4--------------------12/20/2011


    ----Criteria-----
    Start Date: 12/05/2011
    End Date: 12/15/2011


    ----Result----

    Start Date (Column A)---Company Name(Column B)---Project Name(Column C)---End Date(Column D)
    ------12/05/2011------------------Company 2-----------------------Project 2--------------------12/10/2011
    ------12/10/2011------------------Company 3-----------------------Project 3--------------------12/15/2011


    I would like the result to NOT replace the original data

    Thank you for your help!!


    -Crebsington

  2. #2
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    365 Pro Plus
    Posts
    2,274

    Re: VBA Filter Array by Two date Criterias, Help!

    Here's a quick example you could adapt to your needs...
    Please Login or Register  to view this content.
    HTH,
    Rich
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    04-17-2011
    Location
    Orlando
    MS-Off Ver
    Excel 2007
    Posts
    27

    Re: VBA Filter Array by Two date Criterias, Help!

    dangelor, Thank you for your post and your efforts.

    This Code is almost perfect for my needs. I would like the code to filter the data by the two criteria and all the data that falls between the two??

    For Example:

    I have Attached an example of what I would like the results to be if possible
    Attached Files Attached Files

  4. #4
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    365 Pro Plus
    Posts
    2,274

    Re: VBA Filter Array by Two date Criterias, Help!

    In the attached file, I used dynamic named ranges for the Data and Criteria fields. Also, note the syntax of the criteria formulas.
    Please Login or Register  to view this content.
    HTH,
    Rich
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    04-17-2011
    Location
    Orlando
    MS-Off Ver
    Excel 2007
    Posts
    27

    (Solved) Re: VBA Filter Array by Two date Criterias, Help!

    This Works Great! Thank you!!

  6. #6
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: VBA Filter Array by Two date Criterias, Help!

    Hi Crebsington,

    Have you ever though of using an Advanced Filter to do this problem. No VBA needed.
    http://www.contextures.com/xladvfilter02.html
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  7. #7
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    365 Pro Plus
    Posts
    2,274

    Re: (Solved) Re: VBA Filter Array by Two date Criterias, Help!

    You're welcome!

  8. #8
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: VBA Filter Array by Two date Criterias, Help!

    Alternative without named ranges:
    Please Login or Register  to view this content.



+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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