+ Reply to Thread
Results 1 to 7 of 7

Copy Entire Row Data if Multiple Filtering Condition was met.

  1. #1
    Registered User
    Join Date
    06-10-2009
    Location
    United Kingdom
    MS-Off Ver
    Excel 2007, Excel 2003, Excel 2016, Excel 365
    Posts
    93

    Post Copy Entire Row Data if Multiple Filtering Condition was met.

    Hi Everyone,

    Need help on how to filter my data using values in 2 columns. I have below the code created for me and this filters only one column and if the values are true, it will copy the entire row to master file. The filter that i need to add involves Time (AM/PM). Let's us say, in the morning, if I run the macro to copy.. it will copy only the data where the time is AM and then, in the afternoon, the data with PM time should be ADDED to the AM data.


    Please Login or Register  to view this content.
    thanks in advance for helping.
    Attached Files Attached Files
    Last edited by Malou; 03-07-2012 at 03:13 AM. Reason: Title Edit

  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: Multiple Filtering

    As per forum rules, please edit post above and add proper code tags around your code, do it quickly before your post is infracted by a moderator. Thanks.



    Also, update your sample workbook to demonstrate the new values you want evaluated.
    Last edited by JBeaucaire; 03-05-2012 at 12:03 AM.
    _________________
    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
    Registered User
    Join Date
    06-10-2009
    Location
    United Kingdom
    MS-Off Ver
    Excel 2007, Excel 2003, Excel 2016, Excel 365
    Posts
    93

    Re: Copy Entire Row Data if Multiple Filtering Condition was met.

    hi Jerry..

    thanks for reminding.

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

    Re: Copy Entire Row Data if Multiple Filtering Condition was met.

    Maybe....

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    06-10-2009
    Location
    United Kingdom
    MS-Off Ver
    Excel 2007, Excel 2003, Excel 2016, Excel 365
    Posts
    93

    Re: Copy Entire Row Data if Multiple Filtering Condition was met.

    hi Jerry,

    I have another favor, what if the time range for AM is 8:45am to 1:00 PM, then for PM is 2:00pm - 6:00pm?

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

    Re: Copy Entire Row Data if Multiple Filtering Condition was met.

    I'd say it's time for you to figure out what this macro is doing, and edit it accordingly.

    The macro is inserting a REGULAR WORKSHEET FORMULA into column Z, then filtering on the TRUE/FALSE results.

    The formula being inserted into Z6:Z???? is:

    =AND($D6<>"", ISNUMBER(MATCH($D6, $U$6:$U$13, 0)), MOD($I6, 1) < 0.5)

    So for you to continue tweaking this macro, you just to tweak this first formula. Once you get the formula working the way you want, then record yourself entering that formula into Z6. Turn off the recorder, and now you have a VBA version of that same formula:

    .....FormulaR1C1 = "=AND(RC4<>"""", ISNUMBER(MATCH(RC4, R6C21:R13C21, 0)), MOD(RC9,1)<0.5)"

    OK?

    So, 0.5 is "12noon" in Excel decimal values. You can enter whatever time you want into any cell anywhere, then change the formatting of that cell to General and you'll be able to see the decimal value for that time. For instance, 8:45 AM in a cell, GENERAL = 0.364583333.

    Just add more parts to the AND() formula above. To get a time between two other times you would need to add two more parts to the formula:

    MOD(RC9, 1) >= timevalue
    MOD(RC9, 1) < timevalue
    Last edited by JBeaucaire; 03-06-2012 at 01:46 PM.

  7. #7
    Registered User
    Join Date
    06-10-2009
    Location
    United Kingdom
    MS-Off Ver
    Excel 2007, Excel 2003, Excel 2016, Excel 365
    Posts
    93

    Re: Copy Entire Row Data if Multiple Filtering Condition was met.

    hi Jerry,

    Thank you very much for helping. It works exactly what I wanted.

    As i have mentioned from my other post, I'm a newbie and have a little understanding in codes...I really appreciate your help and patience in explaining it.

    Cheers!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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