COUNTIFS Hours and minutes in range

jao1310

New Member
Joined
Jul 22, 2019
Messages
2
Duration hours:mins
Column A
Type of interruption
Column B
Number of cust affected
Column C
Event day? Y/N
Column D
13:39
Unplanned
13
N
43.27
Unplanned 20
N
6:00
Planned
80
N

<tbody>
</tbody>

Hi,

The above table shows a sample of what I am doing.
I'm trying to count the number of instances that meets the following criteria:

Number of instances where Unplanned interruption occrured during none event day that are: (the formula on right is what I currently have on the table but is not working. It only displays "0". I just want to note that the time column (Column A) is formatted as [h]:mm;@

<8 hours
<strike></strike>
=COUNTIFS($A$4:$A$47,"<8:00",$B$4:$B$47,"Unplanned",$D$4:$D$47,"NO")
>8 hours and <12 hours
<strike></strike>
COUNTIFS($A$4:$A$47,">8:00",$A$4:$A$47,"<12:00",$B$4:$B$47,"Unplanned",$D$4:$D$47,"NO")<strike></strike>
=12 hours
<strike></strike>
=COUNTIFS($A$4:$A$47,"=12:00",$B$4:$B$47,"Unplanned",$D$4:$D$47,"NO")
>12 hours and <=24 hours
<strike></strike>
COUNTIFS($A$4:$A$47,">12:00",$A$4:$A$47,"<24:00",$B$4:$B$47,"Unplanned",$D$4:$D$47,"NO")
<strike style="background-color: transparent; border-collapse: collapse; color: rgb(34, 34, 34); font-family: Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: line-through; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; width: auto; word-spacing: 0px;"></strike>
36 to 48 hours
<strike></strike>
COUNTIFS($A$4:$A$47,">36:00",$A$4:$A$47,"=48:00",$B$4:$B$47,"Unplanned",$D$4:$D$47,"NO")
<strike style="background-color: transparent; border-collapse: collapse; color: rgb(34, 34, 34); font-family: Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: line-through; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; width: auto; word-spacing: 0px;"></strike>

<tbody>
</tbody>

Thank you.

Jao
 

CyrusTheVirus

Well-known Member
Joined
Jan 28, 2015
Messages
736
Office Version
365
Platform
Windows
Welcome to the forums.

1) What does Column C have to do with?
2) Where do you want the answers to be displayed?
3) In Column D is it "NO" or just "N"?
4) Can you please paste your whole set of data (or a bit more data), along with your expected results?
 

jao1310

New Member
Joined
Jul 22, 2019
Messages
2
Hi

Thanks heaps for replying.

1) Sorry, column C has nothing to do with it, so maybe just disregard that one.
2.) Answers are displayed below the table.

3) Column D is "NO" not N (Sorry, I was in a hurry yesterday that I put "N" on my sample table, however on my orginal table, answers in Column D are either a YES or NO

4) The table that I provided yesterday is just a sample on how I presented the table and the data. Basically, what I want to do is to COUNT the (Criteria 1) number of 'Unplanned interruptions' on a (Criteria 2) certain range of duration, and that are (Criteria 3) Not a Major event day (so we're looking at the 'NO' answers).
I have a feeling that the problem is how Excel is seeing Time (hours: minutes). I formatted Column A as [h]:mm;@

Column A Column B Column D
Duration of interrution Type of interruption Did this occur on a major event day? YES/NO

12:00 Planned NO
6:00 Unplanned NO
12:35 Unplanned NO
43:51 Unplanned NO
32:22 Planned YES
14:24 Unplanned YES
18:21 Unplanned NO

Expected results (I changed the hour ranges as the previous one is incorrect)

Number of Unplanned interruptions (excluding major event days)
Parameter answer
<8 hours [1]
>8 hours and <=12 hours [0]
=12 hours [1]
>12 hours and <=24 hours [1]
>24 hours <=48 hours [1]

Thank you again.
 

CyrusTheVirus

Well-known Member
Joined
Jan 28, 2015
Messages
736
Office Version
365
Platform
Windows
Will the below work? Copy/Paste the below into excel.

Criteria column cell G2 Formula:
Code:
=IF(ROWS($F$2:F2)=1,COUNTIFS($D$2:$D$8,"NO",$B$2:$B$8,"Unplanned",$A$2:$A$8,"<"&(F2/24)),COUNTIFS($D$2:$D$8,"NO",$B$2:$B$8,"Unplanned",$A$2:$A$8,">"&(F1/24),$A$2:$A$8,"<="&(F2/24)))
Duration (Hrs:Min)Planned/UnplannedNo. Of Cust AffectedEvent day?HoursCriteria
12:00PlannedBlank (For Now)No81
6:00UnplannedBlank (For Now)No120
12:35UnplannedBlank (For Now)No242
43:51UnplannedBlank (For Now)No481
32:22PlannedBlank (For Now)Yes
14:24UnplannedBlank (For Now)Yes
18:21UnplannedBlank (For Now)No

<colgroup><col><col span="2"><col><col><col><col></colgroup><tbody>
</tbody>
 

Forum statistics

Threads
1,081,990
Messages
5,362,584
Members
400,683
Latest member
LogChief

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top