+ Reply to Thread
Results 1 to 21 of 21

filter by today's date

  1. #1
    Forum Contributor
    Join Date
    05-14-2012
    Location
    England
    MS-Off Ver
    Excel 2010/2013
    Posts
    100

    filter by today's date

    Hi I need to filter a worksheet if the date dd/mm/yy in column 5 is =today()-182
    Until now I've been ok filtering by strings etc but...

    Please Login or Register  to view this content.
    Last edited by KAPearson; 05-25-2012 at 02:26 PM.

  2. #2
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: filter by today's date

    Hi,

    Are you wanting 2 filters set?
    One by the "Dept"
    One by the "Date"
    A little mode detail and if possible a redacted copy of your workbook.
    Charles

    There are other ways to do this, this is but 1 !
    Be Sure you thank those who helped.
    IF YOU'RE SATISFIED BY ANY MEMBERS RESPONSE TO YOUR ISSUE PLEASE USE THE STAR ICON AT THE BOTTOM LEFT OF THE POST UNDER THEIR NAME.

  3. #3
    Forum Contributor
    Join Date
    05-14-2012
    Location
    England
    MS-Off Ver
    Excel 2010/2013
    Posts
    100

    Re: filter by today's date

    Hi I would like to filter my main sheet based on if the date in column 5 is = to todays date - 182 days.
    At the mlment i use
    Please Login or Register  to view this content.
    which allows me to filter the sheet by a string but i cant seem to get filter by =today()-182.
    I need to filter in place then copy to a ne sheet. Any ideas?

  4. #4
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: filter by today's date

    Hi,


    Not tested but try

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    05-14-2012
    Location
    England
    MS-Off Ver
    Excel 2010/2013
    Posts
    100

    Re: filter by today's date

    Thanks but it dosnt filter any results must be something about how i'm formating the date

  6. #6
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: filter by today's date

    Hi,

    try
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    05-14-2012
    Location
    England
    MS-Off Ver
    Excel 2010/2013
    Posts
    100

    Re: filter by today's date

    No sorry nothing - I know how frustrating this believe me

  8. #8
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: filter by today's date

    hi,

    Could you post a copy of the workbook?

  9. #9
    Forum Contributor
    Join Date
    05-14-2012
    Location
    England
    MS-Off Ver
    Excel 2010/2013
    Posts
    100

    Re: filter by today's date

    sure thanks give me a sec to unpassword it etc

  10. #10
    Forum Contributor
    Join Date
    05-14-2012
    Location
    England
    MS-Off Ver
    Excel 2010/2013
    Posts
    100

    Re: filter by today's date

    Here you go charles, Just click tab "Menu2" then bakery to see it happily filtering by "Bakery"Tracker.zip
    Ok sorry about that trying to slim it down
    Good luck

  11. #11
    Forum Contributor
    Join Date
    05-14-2012
    Location
    England
    MS-Off Ver
    Excel 2010/2013
    Posts
    100

    Re: filter by today's date

    Sorry Charles I just relised there may not be a date under the orange column with a date over 182 old so you may need to change it before 01/11/11 say

  12. #12
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: filter by today's date

    hi,

    Which module is the code in?

  13. #13
    Forum Contributor
    Join Date
    05-14-2012
    Location
    England
    MS-Off Ver
    Excel 2010/2013
    Posts
    100

    Re: filter by today's date

    sheet 3 (menu2)

  14. #14
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: filter by today's date

    hi,

    Ok, I do not think you can do what you want. What you need to do is once the filter is set in column 3 you need to loop thru the visible rang and see if the date in column is => than the date range specified.
    If it => then copy the data.

  15. #15
    Forum Contributor
    Join Date
    05-14-2012
    Location
    England
    MS-Off Ver
    Excel 2010/2013
    Posts
    100

    Re: filter by today's date

    Thanks anyway at least I'm not going mad!

  16. #16
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: filter by today's date

    hi,

    I'll see if I can come up with something. Unless someone else provide you with the solution.

  17. #17
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: filter by today's date

    Hi,

    If you have a date that you are looking for what do you want to copy? In your code you have the entire column being copied.
    Do you just want the "Person" data copied to another sheet?
    In the workbook you sent I see 2 dates that are <= todays date -182.

  18. #18
    Forum Contributor
    Join Date
    05-14-2012
    Location
    England
    MS-Off Ver
    Excel 2010/2013
    Posts
    100

    Re: filter by today's date

    Hi I need to filter the think 25 column for any dates that are older than today-182 and copy those dates to main2. If I can find that then the other colums will be similar but 182 or 360 days. Once I work out how to filter =today()-182 from vba its plain sailing (hopefuly)

  19. #19
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: filter by today's date

    Hi,

    As mentioned. I do not think you can set a filter for the date you require. You can how ever code the filtered data for "Bakery" and check the visible rows/columns to see if any date is less than or equal to your criteria. I have code that will do this. It can be expanded to look in all of the visible rows/columns. Once it sees the criteria copy the data to the desired sheet for each occurrence of the Date.
    If the date only shows in 1 column the that row/all columns will be copied to the destination sheet.
    Is this what you want?
    lmk
    Last edited by Charles; 05-26-2012 at 08:32 PM.

  20. #20
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: filter by today's date

    bump to top

  21. #21
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: filter by today's date

    OK,

    I code this to loop thru the filtered rang for the specified criteria.
    If in the column 5 all date are ok it will go to the next column to validate the date. If it finds a date that meets the criteria it will then copy that row to the desired sheet.
    For testing I have an "Exit Sub" that will keep the rest of your code from running. You can remove it if you want.
    Now if you want the same situation for each category for "Dept" you can set the code so that it will filter Each department.
    Hope this helps.
    Attached Files Attached Files

  22. #22
    Forum Contributor
    Join Date
    05-14-2012
    Location
    England
    MS-Off Ver
    Excel 2010/2013
    Posts
    100

    Re: filter by today's date

    Brilliant Charles thenks very much for your help. This will solve a couple of problems.

  23. #23
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: filter by today's date

    Hi,

    Thanks for letting me know. And, too thanks for the "Rep"

+ 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