count excel cells between two values

I have a spreadsheet that contains call start dates and call end dates.  Im trying to figure out how I can figure out that maximum # of calls that occur simultaneously through out the month.  I've created another column that lists every date/time, each of the following one increasing by a minute.  I've tried a couple of different formulas, but I just cant figure it out.

In the end, I need to know what the maximum # of simultaneous calls that occur during the month.  I put my interval at a minute to get accurate results.
Who is Participating?
Peter KwanConnect With a Mentor Analyst ProgrammerCommented:
If you need formula, I think


should work for you.

However, it would be tedious and may cost quite a long time because you have 31*60*24=44640 rows for Oct 1 to Oct 31.
maximum # of simultaneous calls
Does this mean the number of calls received during the same hour and minute? If so, you can use this formula (Starting at row 4):


Row 3 will use:


This will give you a running total of the calls received at the same hour and minute. You then use the MAX function to find the highest number. See attached.

Rob HensonFinance AnalystCommented:
I can't upload the file because of the size so will talk through formulas.

I have inserted a couple of rows above the data and in cell F1 & F2 I have used the following formulas to determine the range:

F1 =FLOOR(MIN(A3:A11329),60/1440)

To identify the earliest date and time and rounded down to the hour

F2 =CEILING(MAX(B4:B11329),60/1440)

To identify latest date and time, rounded up to the hour.

In F3 I have linked to F1, and then G3


Copied across loads of column until the result is blank, I have gone 750 but you may need to go more. Gives 1 hour slot headings.

I have then put together a matrix arrangement uinder these headings whereby I have identified each call to a 1 hour slot.

With 11326 rows as per your example and the 750 columns this would give nearly 8.5 million cells with calcs so very resource intensive. For each row below the header I have put the following formula, using F4 as the example:


Checks to see if the Start and Finish time are within that hour slot (note: does not allow for a call starting in one slot and finish in next???)

You can then sum/count the entries in each column and use a MAX to find the highest.

In my calcs I get the max number in a particular hour as being 104 calls in the hour slot ending at 12:00 on 11 October.

Rob H
1.  I put the following formula in cell D2 to count the number of phone calls that occur at the same time as this one. For calculation efficiency, the formula looks 200 cells before and after the starting time. Copy this formula down.
=COUNTIFS(INDEX(A:A,MAX(2,ROW()-200)):A200,"<=" & B2,INDEX(B:B,MAX(2,ROW()-200)):B200,">=" &A2)

2.  In cell E3, I put the following formula to get the max number of simultaneous calls. For the sample data, the answer was 176.

3.  To verify that 200 cells before and after was ample, change it to 500 cells before and after. If the results in column D change, then 200 wasn't big enough. Copy this formula down.
=COUNTIFS(INDEX(A:A,MAX(2,ROW()-500)):A500,"<=" & B2,INDEX(B:B,MAX(2,ROW()-500)):B500,">=" &A2)

For the sample data, the copied down formula recalcs in less than a second.
Hello Byundt
Thank-you for your very prompt response.  I have now posted my question as a new thread.  

However, to answer your question, the cell that gets the formula goes Col E on the same row as the text in Col A.  i.e. If there I text in A4, the formula is in E 4, if there is text in A9, the formula goes in E9.  I tried your suggestion, but it is not returning the result I expect, but I am continuing to work with it.  Regards
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.