Problem trying to see if time falls between 2 times

sharky12345

Well-known Member
Joined
Aug 5, 2010
Messages
3,422
Office Version
  1. 2016
Platform
  1. Windows
I'm using this formula to count the number of instances when a time value falls between 00:00 and 06:00;

=COUNTIF(Deployments!$B$2:$B$998,"<="& 6/24) - COUNTIF(Deployments!$B$2:$B$998,"<="& 0/24)

The range B2:B998 is formatted as Custom hh:mm but the formula result is giving me zero, which is not correct.

Can anyone spot where I am going wrong please?
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Perhaps your times also have a date component. Click on one of the time cells, press [Ctrl]+1 to format the cell and select "General". What value shows there?

WBD
 
Upvote 0
Hi, and thanks - result is as per the time value, no change.
 
Upvote 0
Quick test on some random data show that the formula should work (although you don't need the second COUNTIF):


Book1
BC
200:007
301:00
402:00
503:00
604:00
705:00
806:00
907:00
1008:00
1109:00
Deployments
Cell Formulas
RangeFormula
C2=COUNTIF(Deployments!$B$2:$B$998,"<="&TIME(6,0,0))


WBD
 
Upvote 0
Thanks, it's now working - I copied the time data and pasted it back and for some reason it's solved the problem so must have been something to do with the way the time data was originally entered. Thanks!!
 
Upvote 0

Forum statistics

Threads
1,223,898
Messages
6,175,274
Members
452,628
Latest member
dd2

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