countif command not recoognizing numbers correctly

flexeh

New Member
Joined
Sep 21, 2014
Messages
4
Hi I'm a little confused.

I have a sheet that has a lot of times. There is a column that compares the times and advises the number of minutes between anything less than 5 minutes is a clash with different levels with 00:00:00 being a direct clash.

what I'm trying to do is count the number of times different clashes appear and the amount of minutes.

example - direct clash is 00:00:00 then 00:01:00 then 00:02:00 etc. 00:00:00 works correctly but 00:01:00 brings up 0 even though I know there is entries.

the code I'm using is =COUNTIF(E9:E750,"00:00:00") =COUNTIF(E9:E750,"00:01:00") etc

can anyone advise what I'm doing wrong and why excel doesn't determine the difference. I would attach the file but it says I cannot post attachments, can upload it somewhere if anyone wants to see.

Cheers
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
flexeh,

Welcome to Mr Excel.

In your count if formulas you are looking to count where E9:E750 has a text string . e.g. "00:01:00"

Although your times will display in your sheet as "00:01:00" that is likely just because of the cell's format and the underlying date will be a number. (Date Serial)
You will only get away with the string comparison with zero and "00:00:00"

If it is a pure time then it will be a decimal fraction of 24 hours.

So maybe try like below..


Excel 2007
DEFGH
3Minutes0123
4Count3121
5
6
7
8
900:00:00
1000:01:00
1100:02:00
1200:03:00
1300:00:00
1400:02:00
1500:00:00
Sheet7
Cell Formulas
RangeFormula
E4=COUNTIF($E$9:$E$750,E3/24/60)


If by any chance this doesn't work it could be that your 'times' are actually date & time in which case you will need a revised formula.

Hope that helps.
 
Upvote 0
Hi Snake

Thanks for the quick reply and your welcome. No that hasnt worked, it does for 0 again but the others no. It will be difficult changing all the data as its pulled from a different source. Would there be a work around if the formula has to change? a couple of cells changing all the data rather than having to go through the whole lot.

is there anyway to attach a sheet to the post?
 
Upvote 0
You cannot attach a file via the forum but if necessary you can upload to a share site such as DropBox and post the link.

Before you do that can you just check what format you have in the 'time' cells.
Format a sample cell as Number and see if it changes the cell data to a number.
If so what is that number?
 
Upvote 0
Ok. The problem is that the subtractions that compute the Gap yield a very small rounding error at about the 16th or so decimal place.
So other than when zero, the gap values will never equate to the comparators in B4:B7.

You can get round this as per below by imposing ROUNDING of say 10 digits on all your values.

Drag formulas in C3 and D3 down through B7 and D7
I have used ROWS(B$3:B3)-1 to give the value 0 in row 3 , 1 in row 4 etc so that the formula can drag down.
Also e.g. 1 / 60 / 24 = the time serial fraction for one minute.

In E you do not need SUM(D10-D9) just D10-D9 Then I have applied the rounding.


Excel 2007
ABCDE
1Total Departures726
2Total Clashes
300:00:0015
400:01:0041
500:02:0020
600:03:0052
700:04:0075
8ServiceStandScheduled Departure TimeGap
9530A06:32:00
10530A07:04:0000:32:00
11530A07:24:0000:20:00
12530A07:30:0000:06:00
13530A07:39:0000:09:00
BIL_MF
Cell Formulas
RangeFormula
B3=ROUND((ROWS(B$3:B3)-1)/60/24,10)
D3=COUNTIF($E$9:$E$750,B3)
E10=ROUND(D10-D9,10)


Hope that sorts it.
 
Upvote 0
You sir are a true gent! first glance it looks like its working. problem with my template is there maybe additions to the list so will always have to change the amount for example 750 today might be 820 next week. At least with your commands and help its easily managed now. just going to do the conditional formatting to change the colours for each minute.
 
Upvote 0
Pleased to have helped. Thanks for the feedback.

If your sensible maximum rows of data is 1000 the maybe change the formula in E10 to..

=IF(A10 = "","",ROUND(D10-D9,10))

and drag it down to row 1000.

The clash totals will then ignore any rows beyond where you have data in column A.
 
Upvote 0

Forum statistics

Threads
1,214,652
Messages
6,120,746
Members
448,989
Latest member
mariah3

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