+ Reply to Thread
Results 1 to 7 of 7

COUNTIF Time Range - Time Range provided in Cells

  1. #1
    Registered User
    Join Date
    09-17-2013
    Location
    Edmonton
    MS-Off Ver
    Excel 2007
    Posts
    47

    COUNTIF Time Range - Time Range provided in Cells

    Hello,

    I'm encountering a problem with a Formula. What I'm trying to do is Count within a specific time range, however the time range is provided by the user in two cells and can change at any time. If I type the specific time in the formula, for example =COUNTIF(P3:P162, ">05:00:00")-COUNTIF(P3:P162, ">05:59:00") it works great! But as soon as I do this.... =COUNTIF(P3:P162, ">A1")-COUNTIF(P3:P162, ">B1"), I get a zero. I was hoping this formula was going to work assuming that the user would put 05:00 in A1 and 05:59 in B1.

    Any help would be greatly appreciated! Thanks!

  2. #2
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: COUNTIF Time Range - Time Range provided in Cells

    Try it like this...

    =COUNTIF(P3:P162,">"&A1)-COUNTIF(P3:P162,">"&B1)
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Registered User
    Join Date
    09-17-2013
    Location
    Edmonton
    MS-Off Ver
    Excel 2007
    Posts
    47

    Re: COUNTIF Time Range - Time Range provided in Cells

    Haha wow! awesome! That works.... I was playing around with something similar. What does the "&" sign do?

    Thank you!

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: COUNTIF Time Range - Time Range provided in Cells

    Quote Originally Posted by Eaks77 View Post
    What does the "&" sign do?
    It concatenates the operators, >, to the cell references.

    This particular syntax is not real intuitive!

    Everyone tries it the same way you did: ">A1", but unfortunately it won't work that way. The function evaluates ">A1" as the literal TEXT string >A1.

  5. #5
    Registered User
    Join Date
    09-17-2013
    Location
    Edmonton
    MS-Off Ver
    Excel 2007
    Posts
    47

    Re: COUNTIF Time Range - Time Range provided in Cells

    thank you again.... clearly learn something new everyday

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: COUNTIF Time Range - Time Range provided in Cells

    You're welcome. Thanks for the feedback!


    If your question has been solved please mark the thread as being solved.

    In the menu bar above the very first post select Thread Tools, then select Mark this thread as solved.

  7. #7
    Registered User
    Join Date
    10-12-2013
    Location
    Kelantan, Malaysia
    MS-Off Ver
    Excel 2003
    Posts
    1

    Re: COUNTIF Time Range - Time Range provided in Cells

    Thanks for the help.

+ 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. Replies: 1
    Last Post: 02-24-2014, 07:21 PM
  2. [SOLVED] Counting values in a time range - when the time range crosses midnight
    By dlocos in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-24-2014, 04:27 AM
  3. [SOLVED] Countif / Sumif Range in a 24 Hour Time Range
    By cwwazy in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-16-2013, 04:18 PM
  4. [SOLVED] Find cells within 24 hour time range, time can go to next day
    By LANB5669 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-07-2012, 07:49 PM
  5. countif between a date/time range
    By okl in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 09-25-2009, 08:13 AM

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