+ Reply to Thread
Results 1 to 8 of 8

COUNTIF [hh]:mm format.

  1. #1
    Registered User
    Join Date
    09-24-2018
    Location
    Denmark
    MS-Off Ver
    Newest
    Posts
    3

    COUNTIF [hh]:mm format.

    Im trying to write a =COUNTIF how many times a specifik time occurs.

    So the time I'm looking for is 07:45.

    I tried writing =COUNTIF(C4:L4, 07:45:00), but get an error.
    I also tried =COUNTIF(C4:L4, TIME(7,45,0)), but same error.

    Anyone know what I could do here?

  2. #2
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: COUNTIF [hh]:mm format.

    Could be a floating point issue.

    Try

    =SUMPRODUCT(--(MROUND(C4:L4,time(0,0,1))=TIME(7,45,0))

    You might need to array confirm that with Shift Ctrl Enter.

  3. #3
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: COUNTIF [hh]:mm format.

    Try
    Please Login or Register  to view this content.
    Also you could use the decimal value
    Please Login or Register  to view this content.
    If someone has helped you then please add to their Reputation

  4. #4
    Registered User
    Join Date
    09-24-2018
    Location
    Denmark
    MS-Off Ver
    Newest
    Posts
    3

    Re: COUNTIF [hh]:mm format.

    Figured out part of it.

    Apperently my Excel doesn't have a "=COUNTIF" function, being danish it's called "TÆL.HVIS"... Also the syntax is with a ";" between Range and Criteria.

    Now my next problem is that I wan't to count over 4 different ranges, C4:L4;P4:Y4;C20:L20;P20:Y20, but the seprator being a ";" thats not easy, lol... Sux to be a newbie at things hehe.

  5. #5
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: COUNTIF [hh]:mm format.

    Quote Originally Posted by pjwhitfield View Post
    Also you could use the decimal value
    Please Login or Register  to view this content.
    Which is no differnt to the formula which we have already been informed doesn't work =COUNTIF(C4:L4,TIME(0,45,0))

    The fact that that formula caused an error suggests sme kind of underlying issue.

    @Newbzie, could you be more specific on your meaning of 'get an error' please. In excel terminology, an error and an incorrect result are 2 completely different things.

  6. #6
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: COUNTIF [hh]:mm format.

    In that case

    =TÆL.HVIS(C4:L4;"07:45")+TÆL.HVIS(P4:Y4;"07:45")+TÆL.HVIS(C20:L20;"07:45")+TÆL.HVIS(P20:Y20;"07:45")

    If you need more that 4 ranges then a less conventional method maybe required.

    For example:-

    =SUM(TÆL.HVIS(FORSKYDNING(C4;{0.16};{0;13};1;10);"07:45"))
    Last edited by jason.b75; 09-24-2018 at 07:06 AM.

  7. #7
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: COUNTIF [hh]:mm format.

    You'll need to do multiple COUNTIFs

    eg

    Please Login or Register  to view this content.
    However, are there time values in the ranges not covered by the ranges you want? ie C5:L19 and M20:X20 ? If there is no chance for entries in there to throw it out then you could simply do one COUNTIF (or TÆL.HVIS) covering the full range
    Please Login or Register  to view this content.
    it does however come with risks of some other data affecting it.

  8. #8
    Registered User
    Join Date
    09-24-2018
    Location
    Denmark
    MS-Off Ver
    Newest
    Posts
    3

    Re: COUNTIF [hh]:mm format.

    This worked, thank you

    And thanks all for the help, even confirming that it should have worked, made me think that perhaps the command (COUNTIF) was the issue hehe

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. COUNTIF on a cell format
    By sbeatty in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-26-2017, 04:05 PM
  2. Using COUNTIF to Conditionally Format Cells
    By brreaves in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-05-2014, 12:33 AM
  3. [SOLVED] COUNTIF() format
    By lundy in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-05-2012, 06:48 PM
  4. COUNTIF with Date/Time format from another Workbook
    By adam1230 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-18-2011, 11:56 AM
  5. Replies: 4
    Last Post: 07-05-2007, 07:11 PM
  6. Can one count cells having a certain format? i.e. using countif?
    By KristinG in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-08-2006, 02:05 PM
  7. COUNTIF with non-zero format?
    By LTUser54 in forum Excel General
    Replies: 2
    Last Post: 05-24-2006, 05:45 PM

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