Forumla for find total number of occurences, and then summing the value from the another cell

PlusBob

New Member
Joined
Feb 16, 2016
Messages
15
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
  2. MacOS
  3. Mobile
  4. Web
I have a column with employee names, and a column with hours they worked. There's a list of names, and next to the list I want it the result to be the total added hours for each name. Can you help?

In the example, Column D (Total Hours per Employee) is where I wish the formula to be:
[TABLE="class: cms_table, width: 500"]
<tbody>[TR]
[TD]A
NAME
[/TD]
[TD]B
HOURS
[/TD]
[TD][/TD]
[TD]C
List of Employees
[/TD]
[TD]D
Total hours per Employee
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]John
[/TD]
[TD]1
[/TD]
[TD][/TD]
[TD]Bob
[/TD]
[TD]2
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Bob
[/TD]
[TD]2
[/TD]
[TD][/TD]
[TD]John
[/TD]
[TD]5
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]John
[/TD]
[TD]1
[/TD]
[TD][/TD]
[TD]Mark
[/TD]
[TD]2
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]John
[/TD]
[TD]3
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Mark
[/TD]
[TD]2
[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Well that easy! Here I'm trying to be all complex with it. Thank you Marcelo Branco!
 
Upvote 0
I'm really not trying have anyone do my work :banghead:.


Here's the formula that I have to count total number of entries for the month of October:
=SUMPRODUCT(--(MONTH('Timecard Detail FY16'!H2:H7601)=10))

And this is for total number of hours per employee
=SUMIF('Timecard Detail FY16'!E2:E7601,M3,'Timecard Detail FY16'!M2:M7601)

Sheet: 'Timecard Detail FY16' contains that data. Second sheet has the stats.

I'm trying to combine the two, so that I can show total number of hours per employee per month.
[TABLE="width: 500"]
<tbody>[TR]
[TD]E
Name[/TD]
[TD]H
date (mm/dd/yyyy)[/TD]
[TD]M
Hours per day[/TD]
[TD][/TD]
[TD]Stats Sheet
M
List of Names[/TD]
[TD]Total # of Hrs/Emp/Month
October[/TD]
[TD]November[/TD]
[TD]December[/TD]
[/TR]
[TR]
[TD]John[/TD]
[TD]10/01/2015[/TD]
[TD]2[/TD]
[TD][/TD]
[TD]Bob[/TD]
[TD]6[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Bob[/TD]
[TD]10/01/2015[/TD]
[TD]1[/TD]
[TD][/TD]
[TD]John[/TD]
[TD]3[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Mark[/TD]
[TD]10/01/2015[/TD]
[TD]4[/TD]
[TD][/TD]
[TD]Mark[/TD]
[TD]7[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]John[/TD]
[TD]10/02/2015[/TD]
[TD]1[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Bob[/TD]
[TD]10/02/2015[/TD]
[TD]5[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Mark[/TD]
[TD]10/02/2015[/TD]
[TD]3[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
Maybe something like this (adjust the ranges)


[Table="class: grid"][tr][td="bgcolor: #DCE6F1"][/td][td="bgcolor: #DCE6F1"]
A
[/td][td="bgcolor: #DCE6F1"]
B
[/td][td="bgcolor: #DCE6F1"]
C
[/td][td="bgcolor: #DCE6F1"]
D
[/td][td="bgcolor: #DCE6F1"]
E
[/td][td="bgcolor: #DCE6F1"]
F
[/td][td="bgcolor: #DCE6F1"]
G
[/td][td="bgcolor: #DCE6F1"]
H
[/td][/tr]
[tr][td="bgcolor: #DCE6F1"]
1
[/td][td]
Name​
[/td][td]
date (mm/dd/yyyy)​
[/td][td]
Hours per day​
[/td][td][/td][td]
Year​
[/td][td]
Month​
[/td][td]
Name​
[/td][td]
Hours​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
2
[/td][td]
John​
[/td][td]
09/30/2015​
[/td][td]
5​
[/td][td][/td][td]
2015​
[/td][td]
10​
[/td][td]
Bob​
[/td][td]
6​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
3
[/td][td]
Bob​
[/td][td]
09/30/2015​
[/td][td]
5​
[/td][td][/td][td][/td][td][/td][td]
John​
[/td][td]
3​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
4
[/td][td]
Mark​
[/td][td]
09/30/2015​
[/td][td]
5​
[/td][td][/td][td][/td][td][/td][td]
Mark​
[/td][td]
7​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
5
[/td][td]
John​
[/td][td]
10/01/2015​
[/td][td]
2​
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
6
[/td][td]
Bob​
[/td][td]
10/01/2015​
[/td][td]
1​
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
7
[/td][td]
Mark​
[/td][td]
10/01/2015​
[/td][td]
4​
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
8
[/td][td]
John​
[/td][td]
10/02/2015​
[/td][td]
1​
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
9
[/td][td]
Bob​
[/td][td]
10/02/2015​
[/td][td]
5​
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
10
[/td][td]
Mark​
[/td][td]
10/02/2015​
[/td][td]
3​
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]
[/table]


Formula in H2 copied down
=SUMPRODUCT(--($A$2:$A$10=G2),--(YEAR($B$2:$B$10)=$E$2),--(MONTH($B$2:$B$10)=$F$2),$C$2:$C$10)

M.
 
Upvote 0

Forum statistics

Threads
1,223,892
Messages
6,175,236
Members
452,621
Latest member
Laura_PinksBTHFT

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