+ Reply to Thread
Results 1 to 6 of 6

Countif / Sumif Range in a 24 Hour Time Range

  1. #1
    Registered User
    Join Date
    06-20-2013
    Location
    Atlanta, GA
    MS-Off Ver
    365
    Posts
    26

    Countif / Sumif Range in a 24 Hour Time Range

    Hello All,

    I'm trying to see if it's possible to use the Countif and Sumif formula between 2 date/time ranges without having to manually type in the date and time.
    I have sample data consisting of the number of phone calls received on 5/5/2013 between 12:00 AM and 6:00 AM.
    I want to break up the data by hour and count how many phone calls were received each hour, and the average phone call time per hour.

    Currently the formulas I'm using are:
    =COUNTIFS(B:B,">=5/5/13 12:00 AM",B:B,"<=5/5/13 12:59 AM")
    =SUMIFS(D:D,B:B,">=5/5/13 12:00 AM",B:B,"<=5/5/13 12:59 AM")

    But if my data is across a 24 hour period and across months of data, manually changing the dates would be difficult.
    I tried placing the Date/Time range into a cell and referencing the cell so I can drag the formula down, but I believe I'm missing a character to complete the formula..

    What I want to use or if anyone could help come up with a better formula?
    =COUNTIFS(B:B,">= F12",B:B,"<= G12")
    =SUMIFS(D:D,B:B,">=F12",B:B,"<=G12")

    I have attached a sample wks. The table highlighted in yellow is where I manually typed in the formulas, and the table in red is where I was trying to test the formula.

    Test Data.xlsx

    Regards,
    Andy

  2. #2
    Valued Forum Contributor Harribone's Avatar
    Join Date
    02-24-2013
    Location
    Midlands, UK
    MS-Off Ver
    Excel 2019/365
    Posts
    570

    Re: Countif / Sumif Range in a 24 Hour Time Range

    Hi, firstly thank you for the detail provided with your post and the example spreadsheet it is good to see a problem detailed this well!

    You were very close to getting this right on your own but you need to modify your formulas slighty. For example:

    =COUNTIFS(B:B,">= F12",B:B,"<= G12") <--Cells F12 and G12 are inside the "" so excel doesn't see this cell reference and treats it as text.
    =COUNTIFS(B:B,">="&F12,B:B,"<="&G12) <---Cells F12 and G12 are joined to the ">=" and "<=" to create your criteria.

    Follow this change for your formulas and you should get your results.
    Say thanks, click *

  3. #3
    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
    44,447

    Re: Countif / Sumif Range in a 24 Hour Time Range

    =COUNTIFS(B:B,">="&F3,B:B,"<="&G3)

    =SUMIFS(D:D,B:B,">"&$F3,B:B,"<="&$G3)

    and:

    =IFERROR(I3/H3,"")

    Regards, TMS
    Last edited by TMS; 07-16-2013 at 02:11 PM.
    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


  4. #4
    Registered User
    Join Date
    06-20-2013
    Location
    Atlanta, GA
    MS-Off Ver
    365
    Posts
    26

    Re: Countif / Sumif Range in a 24 Hour Time Range

    Hi Harribone / TMShucks,

    Thanks for the response and guidance!
    Formula worked perfectly!

    Regards,
    Andy

  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
    44,447

    Re: Countif / Sumif Range in a 24 Hour Time Range

    You're welcome. Thanks for the rep.

  6. #6
    Valued Forum Contributor Harribone's Avatar
    Join Date
    02-24-2013
    Location
    Midlands, UK
    MS-Off Ver
    Excel 2019/365
    Posts
    570

    Re: Countif / Sumif Range in a 24 Hour Time Range

    Ditto.
    Good luck with the rest of your work.

+ 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. Calculating Time Range of cells less than 1 hour
    By Bil4646l in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-22-2013, 09:23 PM
  2. [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
  3. Military time range to decimal of hour
    By slopland in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-31-2010, 03:25 AM
  4. Sumif, Averageif, Countif, From a range
    By Odysseus in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-09-2008, 12:43 PM
  5. Time w/in Each Hour of Day btwn a Time Range
    By gbrogmus in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 12-30-2007, 03:01 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