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

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
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,224,824
Messages
6,181,186
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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