# 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.
calls1.xlsx
###### Who is Participating?

Analyst ProgrammerCommented:
If you need formula, I think

=COUNTIFS(A:A,"<="&indirect("C"&Row()),B:B,">="&indirect("C"&Row()))

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.
0

Commented:
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):

=IF(HOUR(A4)&MINUTE(A4)=HOUR(A3)&MINUTE(A3),E3+1,0)

Row 3 will use:

=IF(HOUR(A3)&MINUTE(A3)=HOUR(A2)&MINUTE(A2),1,0)

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.

Flyster
calls1.xlsx
0

Finance 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

=IF(F3="","",IF(F3+60/1440<\$F\$2,F3+60/1440,""))

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:

=IF(AND(\$A4>E\$3,\$A4<F\$3,\$B4>E\$3,\$B4<F\$3),1,0)

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.

Thanks
Rob H
0

Commented:
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.
=MAX(D:D)

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.
calls1Q28352918.xlsx
0

Commented:
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
0
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.