Count cell if condition is time

lousydull

New Member
Joined
Aug 7, 2018
Messages
7
Please can someone help to come up with formula that would count cells with text if condition is "time"? The "count" column is where the formula that would count the number of fruits once the "start and end" time were met. Example: the first count in "count" column is 2 - this is because "apple and pears" are with in 5:00 AM and 5:59 AM.[TABLE="width: 500"]
<tbody>[TR]
[TD]Time[/TD]
[TD]Fruits[/TD]
[TD][/TD]
[TD]Start[/TD]
[TD]End[/TD]
[TD]Count[/TD]
[TD]Explanation[/TD]
[/TR]
[TR]
[TD]5:30 AM[/TD]
[TD]Apple[/TD]
[TD][/TD]
[TD]5:00 AM[/TD]
[TD]5:59 AM[/TD]
[TD]2[/TD]
[TD]Apple & Pears[/TD]
[/TR]
[TR]
[TD]6:35 AM[/TD]
[TD]Banana[/TD]
[TD][/TD]
[TD]6:00 AM[/TD]
[TD]6:59 AM[/TD]
[TD]1[/TD]
[TD]Banana[/TD]
[/TR]
[TR]
[TD]7:20 AM[/TD]
[TD]Orange[/TD]
[TD][/TD]
[TD]7:00 AM[/TD]
[TD]7:59 AM[/TD]
[TD]1[/TD]
[TD]Orange[/TD]
[/TR]
[TR]
[TD]9:02 AM[/TD]
[TD]Apple[/TD]
[TD][/TD]
[TD]8:OO AM[/TD]
[TD]8:59 AM[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]10: 56 AM[/TD]
[TD]Kiwi[/TD]
[TD][/TD]
[TD]9:00 AM[/TD]
[TD]9:59 AM[/TD]
[TD]1[/TD]
[TD]Apple[/TD]
[/TR]
[TR]
[TD]5: 40 AM[/TD]
[TD]Pears[/TD]
[TD][/TD]
[TD]10: AM[/TD]
[TD]10:59 AM[/TD]
[TD]1[/TD]
[TD]Kiwi[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Like this?

Excel Workbook
ABCDE
1TimeFruitsStartEndCount
25:30 AMApple5:00 AM5:59 AM2
36:35 AMBanana6:00 AM6:59 AM1
47:20 AMOrange7:00 AM7:59 AM1
59:02 AMApple8:00 AM8:59 AM0
610:56 AMKiwi9:00 AM9:59 AM1
75:40 AMPears10:00 AM10:59 AM1
Count
 
Upvote 0
Like this?

Count

ABCDE
Fruits
Apple
Banana
Orange
Apple
Kiwi
Pears

<tbody>
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]1[/TD]
[TD="align: right"]Time[/TD]

[TD="align: right"]Start[/TD]
[TD="align: right"]End[/TD]
[TD="align: right"]Count[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]2[/TD]
[TD="align: right"]5:30 AM[/TD]

[TD="align: right"]5:00 AM[/TD]
[TD="align: right"]5:59 AM[/TD]
[TD="align: right"]2[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]3[/TD]
[TD="align: right"]6:35 AM[/TD]

[TD="align: right"]6:00 AM[/TD]
[TD="align: right"]6:59 AM[/TD]
[TD="align: right"]1[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]4[/TD]
[TD="align: right"]7:20 AM[/TD]

[TD="align: right"]7:00 AM[/TD]
[TD="align: right"]7:59 AM[/TD]
[TD="align: right"]1[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]5[/TD]
[TD="align: right"]9:02 AM[/TD]

[TD="align: right"]8:00 AM[/TD]
[TD="align: right"]8:59 AM[/TD]
[TD="align: right"]0[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]6[/TD]
[TD="align: right"]10:56 AM[/TD]

[TD="align: right"]9:00 AM[/TD]
[TD="align: right"]9:59 AM[/TD]
[TD="align: right"]1[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]7[/TD]
[TD="align: right"]5:40 AM[/TD]

[TD="align: right"]10:00 AM[/TD]
[TD="align: right"]10:59 AM[/TD]
[TD="align: right"]1[/TD]

</tbody>

Spreadsheet Formulas
CellFormula
E2=COUNTIFS(A$2:A$7,">="&C2,A$2:A$7,"<="&D2)

<tbody>
</tbody>

<tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4
================
Column E is the reult of counting the number of fruits once criteria in Column C & D are met. Example E2 would count all fruits from 5:00 AM to 5:59 AM, thus the result is 2.
 
Upvote 0
Example E2 would count all fruits from 5:00 AM to 5:59 AM, thus the result is 2.
My formula did return 2 in E2, so I assume it does what you want unless you specify/give examples differently.
 
Last edited:
Upvote 0


How about this one, get the sum if "time" is between column D & E. Example: F2 has 3 as sum of those between 5:00AM to 5:59AM.
 
Upvote 0
You can't post an image from your computer like that.
Can you post it like I did (link in my signature block below for help with that) or at least like you did in the first post?
 
Upvote 0
You can't post an image from your computer like that.
Can you post it like I did (link in my signature block below for help with that) or at least like you did in the first post?
==============
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD="align: center"]Time[/TD]
[TD="align: center"]#[/TD]
[TD="align: center"]Start[/TD]
[TD="align: center"]End[/TD]
[TD="align: center"]Sum[/TD]
[/TR]
[TR]
[TD]5:50 AM[/TD]
[TD]1[/TD]
[TD]5:00 AM[/TD]
[TD]5:59 AM[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]6:40 AM[/TD]
[TD]1[/TD]
[TD]6:00 AM[/TD]
[TD]6:59 AM[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]7:30 AM[/TD]
[TD]1[/TD]
[TD]7:00 AM[/TD]
[TD]7:59 AM[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]5:12 AM[/TD]
[TD]1[/TD]
[TD]8:00 AM[/TD]
[TD]8:59 AM[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]6:29 AM[/TD]
[TD]1[/TD]
[TD]9:00 AM[/TD]
[TD]9:59 AM[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]10:30 AM[/TD]
[TD]1[/TD]
[TD]10:00 AM[/TD]
[TD]10:59 AM[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]5:25 AM[/TD]
[TD]1[/TD]
[TD]11:00 AM[/TD]
[TD]11:59 AM[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
here's the table sir
 
Upvote 0
here's the table sir
The formula I gave you in post 2 already produces those results so I can't see what you are wanting that is different. :huh:

Unless the values in the # column can be something other than 1 (but you haven't said so or given an example like that) and you want to sum those values in the # column when the times are relevant (but you have not mentioned summing the # column) in which case try something like this.

Excel Workbook
ABCDEF
1Time#StartEndSum
25:50 AM55:00 AM5:59 AM8
36:40 AM16:00 AM6:59 AM2
47:30 AM37:00 AM7:59 AM3
55:12 AM28:00 AM8:59 AM0
66:29 AM19:00 AM9:59 AM0
710:30 AM510:00 AM10:59 AM5
85:25 AM111:00 AM11:59 AM0
9
Count (2)
 
Upvote 0

Forum statistics

Threads
1,223,907
Messages
6,175,300
Members
452,633
Latest member
DougMo

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