How to find the number of rows that have date time fields between 5 and 6 PM

jshwhitlow

New Member
Joined
May 4, 2016
Messages
1
I am using Microsoft Excel 2011 for Mac.

I have a phone log that I want to report some data off of. All of the solutions out there that I have looked up seem to assume I only have a time value and that they don't include an actual date.

I have a bunch of dates like this:

  • 2/1/16 3:39 AM
  • 2/1/16 10:06 AM
  • 2/1/16 10:27 AM
  • 2/1/16 10:34 AM
  • 2/1/16 10:38 AM
Except I have around 1200 phone calls. (1288 rows total)
I want to know how many phone calls we have received between 5PM and 6PM.
So far I have tried the following and none of them worked:
<code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: inherit;">=COUNTIFS(C2:C1288,">="&B1,C2:C1288,"<="&B2)

=COUNTIF(C2:C1288,">=17:00:00")-COUNTIF(C2:C1288,">18:00:00")

=SUMPRODUCT((C2:C1288>=TIME(17,0,0))*(C2:C1288 <=TIME(18,0,0)))
</code>Bonus points if you can also help me group phone numbers to tell me how many rows contain the same numbers. (5555555555 has 3 rows)(4444444444 has 2 rows)

  • 5555555555
  • 4444444444
  • 3333333333
  • 6666666666
  • 5555555555
  • 8888888888
  • 5555555555
  • 4444444444
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
I would probably add a helper column to extract the time out of the existing cell.

= ROUND(RIGHT(TimeDateCell,LEN(TimeDateCell)-FIND(".",TimeDateCell,1)+1),4)

From their you should be able to achieve what you want, either via a pivot table or a countif formula.

note I am assuming your date/time field is stored as a serial number.
 
Last edited:
Upvote 0
Hi jshwhitlow
For Problem 1: Make sure you have change format of columns to time. Time in cell writed basedon 24 hours. For Example 18:00:00 equal to 18/24= 0.75
Thus for your problem and count no. of phone calls:
Code:
=COUNTIFS(B2:B1200,"<= 0.75",B2:B1200,">= 0.708333333")

For Problem 2:

  • Click the Data Ribbon Menu
  • Select the Advanced Button in the Sort & Filter section
  • Fill in the dialog Box, copying the results to another location and you have same range for List range and Criteria Range ($B2:$B1200) and for Copy to select first cell of another Column (F2) and making sure you tick Unique records only
And You have List of number on another column (example Column F From F2:F200)
After that you write this formula to neighbor column ( Column G) Cell G2.
Code:
=COUNTIF($B$2:$B$1200,F2)
And fill down to last listed rows cell (G200)
 
Last edited:
Upvote 0
try this

Code:
=SUMPRODUCT(--(TIME(HOUR(C2:C1288),MINUTE(C2:C1288), SECOND(C2:C1288))>=TIME(17,0,0))*--(TIME(HOUR(C2:C1288),MINUTE(C2:C1288), SECOND(C2:C1288))<=TIME(18,0,0)))
 
Upvote 0
for the phone numbers in column A, try this in column B and copy down

=COUNTIF(A:A,A1)
 
Upvote 0

Forum statistics

Threads
1,215,833
Messages
6,127,162
Members
449,368
Latest member
JayHo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top