Solved

count excel cells between two values

Posted on 2014-01-30
6
281 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 16

Accepted Solution

by:
Peter Kwan earned 500 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 33

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Suggested Solutions

Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

737 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