Count require..Based on Start time

VBABEGINER

Well-known Member
Joined
Jun 15, 2011
Messages
1,232
On Sheet1
Code:
[TABLE="width: 299"]
<colgroup><col><col><col span="2"></colgroup><tbody>[TR]
[TD]Department Name[/TD]
[TD]12:00 AM[/TD]
[TD]1:00 AM[/TD]
[TD="align: right"]2:00 AM[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
</tbody>[/TABLE]
....and so on till 11.00 pm

On Sheet2, I have Start time data
Code:
[TABLE="width: 159"]
<colgroup><col></colgroup><tbody>[TR]
[TD]Shift Start Time (24 hour format[/TD]
[/TR]
[TR]
[TD]13:30[/TD]
[/TR]
[TR]
[TD]13:30[/TD]
[/TR]
[TR]
[TD]13:30[/TD]
[/TR]
[TR]
[TD]13:30[/TD]
[/TR]
[TR]
[TD]22:30[/TD]
[/TR]
[TR]
[TD]22:30[/TD]
[/TR]
[TR]
[TD]13:30[/TD]
[/TR]
[TR]
[TD]22:30[/TD]
[/TR]
[TR]
[TD]13:30[/TD]
[/TR]
[TR]
[TD]13:30[/TD]
[/TR]
[TR]
[TD]22:30[/TD]
[/TR]
[TR]
[TD]13:30[/TD]
[/TR]
[TR]
[TD]13:30[/TD]
[/TR]
[TR]
[TD]22:30[/TD]
[/TR]
</tbody>[/TABLE]

I need count of respective time in Sheet 1. If Start time is 00.55, then count of this goes in "12.00 AM"..

Any one provide this formula..
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
In [Sheet1] you have DEPARTMENT listed.

In [Sheet2], there is no department information.

Do your worksheets represent department (i.e. Sheet1 = Department A... Sheet2 = Department B.. and so on)

OR..

Should there be data for the DEPARTMENT in [Sheet2], listed alongside the [Shift Start Time (24 hour format)] field?

OR..

Something else.

Put another way.. In the table in [Sheet1] where you've listed out the DEPARTMENTS.. where does that information come from - how do we match up the aggregated data against the rows?


When you say "COUNT" do you mean it would appear like this:


DepartmentShift Start Time
A00:55
A00:58
A01:30
B00:23

<tbody>
</tbody>



Department12:00am01:00am02:00am
A210
B1
C

<tbody>
</tbody>
 
Upvote 0
Thanks for revert..

In [Sheet2], there is no department information. = it is there..in Col E. And "Start Time" in Col G.

Do your worksheets represent department (i.e. Sheet1 = Department A... Sheet2 = Department B.. and so on) = NO

OR..

Should there be data for the DEPARTMENT in [Sheet2], listed alongside the [Shift Start Time (24 hour format)] field? = YES, as said above.



Put another way.. In the table in [Sheet1] where you've listed out the DEPARTMENTS.. where does that information come from - how do we match up the aggregated data against the rows? = Sheet 1 tabular format is fixed..


When you say "COUNT" do you mean it would appear like this:

Yes....I require in this format..

Department12:00am01:00am02:00am
A210
B1
C

<tbody>
</tbody>
[/QUOTE]

Using CountIfs we can do that..I tried also. But hw come it will display the output?
The reason B'coz, In sheet1 my tabular format is like this-

Code:
[TABLE="width: 479"]
<tbody>[TR]
[TD]Department Name[/TD]
[TD]12:00 AM[/TD]
[TD]1:00 AM[/TD]
[TD="align: right"]2:00 AM[/TD]
[TD="align: right"]3:00 AM[/TD]
[TD="align: right"]4:00 AM[/TD]
[TD="align: right"]5:00 AM[/TD]
[/TR]
[TR]
[TD]HR[/TD]
[TD]2[/TD]
[TD]1[/TD]
[TD]5[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]IT[/TD]
[TD]Whatever[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]FINANCE[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
small note..in above example, i changed department names A, B, C to HR, IT, FINANCE resp.

Formula I used, for your reference..on sheet1
Code:
=COUNTIFS(Sheet2!E2:E97,Sheet1!A4,Sheet2!G2:G97,Sheet1!B2)
where,
E2:E97 = Department Names
Sheet1!A4 = "HR"
Sheet1!B2 = "12:00 AM"
 
Last edited:
Upvote 0
This site is not opening at my end..security reason..


Use this:



Excel 2010
ABCD
3Department00:0001:0002:00
4HR100
5IT000
6FINANCE000

<tbody>
</tbody>
Sheet1

Worksheet Formulas
CellFormula
B4=SUMPRODUCT(--(Sheet2!$E$1:$E$5000 = $A4),--(Sheet2!$G$1:$G$5000 >= B$3),--(Sheet2!$G$1:$G$5000 < C$3<c$3< font="">)</c$3<>)

<tbody>
</tbody>

<tbody>
</tbody>

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Excel 2010
EFG
1DeptStartTime
2HR00:10
3IT13:30
4FINANCE13:30
5FINANCE13:30
6HR22:30
7HR22:30
8FINANCE13:30
9HR15:30
10IT13:30
11IT13:30
12IT22:30
13FINANCE13:30
14HR13:30
15HR22:30

<tbody>
</tbody>



Sheet2


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

After you've entered the formula into B4, copy and paste it to the relevant cells.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,430
Messages
6,124,849
Members
449,194
Latest member
HellScout

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