+ Reply to Thread
Results 1 to 3 of 3

Auto Filter By Times

  1. #1
    Valued Forum Contributor realniceguy5000's Avatar
    Join Date
    03-20-2008
    Location
    Fl
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    951

    Auto Filter By Times

    Hi, I have a workbook I am trying to autofilter(Col I) by time greater than 4:00:00 am but less than 11:59:59pm but I'm not getting any results returned? I included a test book to help.

    Thank You, Mike

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by realniceguy5000; 03-14-2012 at 01:41 PM.

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Auto Filter By Times

    Mike,

    The problem is that column I is date and time, not just time. For example, I2 is 3/12/2012 4:07:23 PM. Excel handles dates and times with numbers. Each whole day is one whole number, and hours, minutes, and seconds are fractions of a whole number. So that cell is actually the number 40980.67179 formatted as "h:mm:ss AM/PM". When you define your start and end times, you are defining them without a date, so they are 0.xxx and 0.yyy and when you filter for items greater than 0.xxx and less than 0.yyy, you get no results because everything in column I is 40980.zzz and higher.

    To correct this, the macro can create a helper column to extract just the time values without dates from column I, and then filter the helper column:
    Please Login or Register  to view this content.
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Valued Forum Contributor realniceguy5000's Avatar
    Join Date
    03-20-2008
    Location
    Fl
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    951

    Re: Auto Filter By Times

    Thanks Tiger, works great now.

+ 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