Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

count excel cells between two values

Posted on 2014-01-30
6
Medium Priority
?
285 Views
Last Modified: 2015-01-24
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
0
Comment
Question by:colonialiu20
6 Comments
 
LVL 16

Accepted Solution

by:
Peter Kwan earned 2000 total points
ID: 39823046
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
 
LVL 22

Expert Comment

by:Flyster
ID: 39823273
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
 
LVL 34

Expert Comment

by:Rob Henson
ID: 39823605
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
 
LVL 81

Expert Comment

by:byundt
ID: 39824216
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
 

Expert Comment

by:elimishia
ID: 40568771
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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question