+ Reply to Thread
Results 1 to 5 of 5

Using COUNTIF and dates of different formats

  1. #1
    Registered User
    Join Date
    10-06-2011
    Location
    Salt Lake City, UT
    MS-Off Ver
    Excel 2010
    Posts
    78

    Using COUNTIF and dates of different formats

    I have a table with the start time of a tour and the visitor's name. The start time is in m/d/yyyy h:mm:ss AM/PM format. On a separate portion of the spreadsheet I want to count the number of tours given by day. I tried simply using =COUNTIF(Table1[Start Time],G$2) where G2 is a date in m/d/yyyy format, but the count comes up as zero even when there were visitors on that day because each tour has a unique time of day. Is there anyway to use wildcards or something to make the count function properly? See the attached excel file.

    Thanks
    Attached Files Attached Files
    Last edited by perducci; 01-18-2012 at 07:01 PM.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,498

    Re: Using COUNTIF and dates of different formats

    One way:

    Cell F3: =SUMPRODUCT(--(DAY($B$3:$B$18)=DAY(F$2)),--(MONTH($B$3:$B$18)=MONTH(F$2)))

    and copy across.


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    365
    Posts
    2,243

    Re: Using COUNTIF and dates of different formats

    Or,

    =COUNTIF(Table1[Start Time],">="&F$2)-COUNTIF(Table1[Start Time],">"&F$2+"23:59:59")

    =SUMPRODUCT(--(TEXT(Table1[Start Time],"dmyyyy")=TEXT(F$2,"dmyyyy")))

    Copy across
    Regards,
    Haseeb Avarakkan

    __________________________________
    "Feedback is the breakfast of champions"

  4. #4
    Registered User
    Join Date
    10-06-2011
    Location
    Salt Lake City, UT
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Using COUNTIF and dates of different formats

    Those work wonderfully. Much appreciated.

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,498

    Re: Using COUNTIF and dates of different formats

    You're welcome.


    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

+ 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