Table Pulling Hours Per Person, Per Month

FightMilk

New Member
Joined
Aug 1, 2018
Messages
3
Hello! I'm somewhat new to Excel, so I pre-apologize for any ignorance and appreciate your time. I am working on a spreadsheet for a small department where I work to track our time at the company's various locations. I have a setup with a couple of sheets, the first with the information being input, the second with a couple of tables pulling data from the first. I have been trying to get a table working that pulls data on the hours each person in the department spends offsite (away from our main site) during each month. So the data sheet looks something like:
[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD](A) Initials[/TD]
[TD](B) Date[/TD]
[TD](C) Time In[/TD]
[TD](D) Time Out[/TD]
[TD](E) Hours[/TD]
[TD](F) Location[/TD]
[/TR]
[TR]
[TD]AAA
[/TD]
[TD]7/16/18[/TD]
[TD]7:32[/TD]
[TD]14:35[/TD]
[TD]7:00[/TD]
[TD]Site#2[/TD]
[/TR]
[TR]
[TD]BBB[/TD]
[TD]7/19/18[/TD]
[TD]8:43[/TD]
[TD]17:24[/TD]
[TD]8:45[/TD]
[TD]Site#4[/TD]
[/TR]
[TR]
[TD]AAA[/TD]
[TD]7/22/18[/TD]
[TD]7:01[/TD]
[TD]15:03[/TD]
[TD]8:00[/TD]
[TD]Site#3[/TD]
[/TR]
</tbody>[/TABLE]

So A:F columns are the persons initials, the date, their time in, their time out, an hours column auto calculated and rounded to 15 minute intervals, and finally the location of the site they were at.

I haven't been able to get a working formula to pull the data for each person, for each month. For example, AAA put in 15 hours offsite in July. I have read countless sites and tried countless formulas. I would greatly appreciate your help on this. The formula I have right now is:

=SUMPRODUCT(--(MONTH((Sheet1!$B:$B)=F2)), --(Sheet1!$A:$A="AAA"), Sheet1!$E:$E)

F2 in this is on sheet two and is a cell formatted for the month but is just 1/1/2018 in the cell. The month function in this doesn't seem to be working in this, as it just currently pulls all of the total hours from all months for AAA. Is this a problem with the way I am using the month function? I tried using different already existing cells for the month instead of F2, but that didn't help. Sorry if my mistake is egregious or obvious. Like I've mentioned, I'm fairly new to excel.

Thanks for your time!
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
If I'm understanding it correctly you are comparing the month in F2 to the month in column B so maybe something like...

=SUMPRODUCT(--(MONTH((Sheet1!$B:$B)=MONTH(F2))), --(Sheet1!$A:$A="AAA"), Sheet1!$E:$E)
 
Upvote 0
[TABLE="class: grid"]
<tbody>[TR]
[TD][/TD]
[TD]
A
[/TD]
[TD]
B
[/TD]
[TD]
C
[/TD]
[TD]
D
[/TD]
[TD]
E
[/TD]
[TD]
F
[/TD]
[TD]
G
[/TD]
[TD]
H
[/TD]
[/TR]
[TR]
[TD]
1
[/TD]
[TD] Initials[/TD]
[TD] Date[/TD]
[TD]Time In[/TD]
[TD] Time Out[/TD]
[TD] Hours[/TD]
[TD]Location[/TD]
[TD][/TD]
[TD]Sheet1[/TD]
[/TR]
[TR]
[TD]
2
[/TD]
[TD]AAA[/TD]
[TD]
7/16/2018​
[/TD]
[TD]
7:32​
[/TD]
[TD]
14:35​
[/TD]
[TD]
7:00​
[/TD]
[TD]Site#2[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
3
[/TD]
[TD]BBB[/TD]
[TD]
7/19/2018​
[/TD]
[TD]
8:43​
[/TD]
[TD]
17:24​
[/TD]
[TD]
8:45​
[/TD]
[TD]Site#4[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
4
[/TD]
[TD]AAA[/TD]
[TD]
7/22/2018​
[/TD]
[TD]
7:01​
[/TD]
[TD]
15:03​
[/TD]
[TD]
8:00​
[/TD]
[TD]Site#3[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


[TABLE="class: grid"]
<tbody>[TR]
[TD][/TD]
[TD]
A
[/TD]
[TD]
B
[/TD]
[TD]
C
[/TD]
[TD]
D
[/TD]
[TD]
E
[/TD]
[TD]
F
[/TD]
[TD]
G
[/TD]
[TD]
H
[/TD]
[TD]
I
[/TD]
[/TR]
[TR]
[TD]
1
[/TD]
[TD]inital[/TD]
[TD] Hours[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]month[/TD]
[TD][/TD]
[TD][/TD]
[TD]Sheet2[/TD]
[/TR]
[TR]
[TD]
2
[/TD]
[TD]AAA[/TD]
[TD]
15:00:00​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]
7/1/2018​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
3
[/TD]
[TD]BBB[/TD]
[TD]
8:45:00​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Sheet2

b2=
SUMPRODUCT((Sheet1!$A$2:$A$4=Sheet2!A3)*(MONTH(Sheet1!$B$2:$B$4)=MONTH(Sheet2!$F$2))*(Sheet1!$E$2:$E$4)) copy down

Column B custom format [h]:mm:ss
 
Upvote 0
If I'm understanding it correctly you are comparing the month in F2 to the month in column B so maybe something like...

=SUMPRODUCT(--(MONTH((Sheet1!$B:$B)=MONTH(F2))), --(Sheet1!$A:$A="AAA"), Sheet1!$E:$E)
Yeah, thats what I am going for. Essentially taking the month in F2 on Sheet2 and then running through the column B on Sheet1 and pulling any data matching the month from Sheet2!F2, if that makes sense. This formula seems to give me the same total hours from ALL months, unfortunately. Thank you though! Maybe I'm doing something wrong with it.



b2=
SUMPRODUCT((Sheet1!$A$2:$A$4=Sheet2!A3)*(MONTH(Sheet1!$B$2:$B$4)=MONTH(Sheet2!$F$2))*(Sheet1!$E$2:$E$4)) copy down

Column B custom format [h]:mm:ss

Thank you!! This works until I try to change the A2:A4, B2:B4, and E2:E4 to just A:A, B:B, and E:E respectively. Is there a reason why when I try to just make it apply to the entire column it no longer works? It works if I just designate a specific range in the column, like B2:B25 for example.

Also, out of my own curiosity so I can learn for future excel usage, it looks like between these two formulas the two of you gave, I was using the MONTH formula wrong, yes? It looks like I need to do =MONTH(Range)=MONTH(MonthCelltoSpecifyMonth)
Is that correct?

And again, I appreciate both of your time and help on these issues.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,322
Members
452,635
Latest member
laura12345

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