Add duration based on selected date range

Eric Livesay

Board Regular
Joined
Feb 13, 2008
Messages
131
Office Version
  1. 2019
Platform
  1. Windows
Hello all and prior thanks for any assistance given!

I have a spreadsheet for tracking volunteer hours. I have a column for that days date (formatted YYYY, Mmm, D). And another column that shows the duration of their volunteer hours based on time in and time out columns.

I would like to be able to have a cell where I can type or select a specific month and year, then have another cell add up the work hours just for that month. Can't figure it out.

I can upload a mock spreadsheet if necessary.
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
if you put the month into a cell , as say 1/1/25 - so JAN
SUMIFS( column for hours , Dates column , ">="&Date cell, Dates column , "<="&EOMONTH(Date cell, 0))
format the cell with the sumif as [H]:mm

a mockup would help

but heres one i made
Book2
ABCDEF
1dateHoursMONTH =2/1/24
21/1/241:02
32/1/242:10TOTAAL30:18:00
43/1/243:18
54/1/244:26
65/1/245:34
76/1/246:42
87/1/247:50
91/1/248:58
102/1/2410:06
113/1/2411:14
124/1/2412:22
135/1/2413:30
146/1/2414:38
157/1/2415:46
161/1/2416:54
172/1/2418:02
183/1/2419:10
194/1/2420:18
205/1/2421:26
216/1/2422:34
227/1/2423:42
23
Sheet1
Cell Formulas
RangeFormula
F3F3=SUMIFS(C2:C22,A2:A22,">="&F1,A2:A22,"<="&EOMONTH(F1,0))


A SMALL sample spreadsheet, around 10-20 rows, would help a lot here, with all sensitive data removed, and expected results mocked up and manually entered, with a few notes of explanation.

This will possibly enable a quicker and more accurate solution for you.

MrExcel has a tool called “XL2BB” that lets you post samples of your data and will allow us to copy/paste your sample data into our Excel spreadsheets, saving a lot of time.

You can also test to see if it works ok, in the "Test Here" forum.

OR if you cannot get XL2BB to work, or have restrictions on your PC

then put the sample spreadsheet onto a share

I only tend to goto OneDrive, Dropbox or google docs , as I'm never certain of other random share sites and possible virus.
Please make sure you have a representative data sample and also that the data has been desensitised, remember this site is open to anyone with internet access to see - so any sensitive / personal data should be removed

Make sure you set any share or google to share to everyone
 
Upvote 0
I've never done a mini sheet before but here goes:

leena formula.xlsx
ABCDEF
1Name:Bandy, MattNotes
2Phone Number:
3Emergency Contact:
4Emergency Contact Phone Number:
5Relationship To Emergency Contant:
6Enter date in "Month Query" cell. Ex: 2024 feb. Then the cell under "total month hours" shows the total number of hours worked for that month.
7DateTime InMonth QueryTotal Month HoursTasks/#Staff Initial
82024 feb
9Time OutTotal Time
10CTRL + ; to insert today's dateCTRL + ; to insert today's dateCTRL + ; to insert today's date
112024, Jan 84:00:00 PM6:00:00 PM02:00:00Adult Education WorkshopML
122024, Jan 94:00:00 PM6:00:00 PM02:00:00ML
132024, Jan 224:00:00 PM6:00:00 PM02:00:00ML
142024, Jan 294:00:00 PM6:00:00 PM02:00:00ML
152024, Jan 304:00:00 PM6:00:00 PM02:00:00ML
162024, Feb 54:00:00 PM6:00:00 PM02:00:00ML
172024, Feb 64:00:00 PM6:00:00 PM02:00:00ML
182024, Feb 124:00:00 PM6:00:00 PM02:00:00ML
192024, Feb 134:00:00 PM6:00:00 PM02:00:00ML
Sheet1
 
Upvote 0
OK,
The date column has not come across as real dates , but text
are they real dates ?
I have a column for that days date (formatted YYYY, Mmm, D).

I have changed to real dates and formatted as YYYY, MMM, D

=SUMIFS(D10:D100,A10:A100,">="&C7,A10:A100,"<="&EOMONTH(C7,0))

Book3
ABCDEF
1Name:Bandy, MattNotes
2Phone Number:
3Emergency Contact:
4Emergency Contact Phone Number:
5Relationship To Emergency Contant:
6DateTime InMonth QueryTotal Month HoursTasks/#Staff Initial
72024, Feb8:00
8Time OutTotal Time
9CTRL + ; to insert today's dateCTRL + ; to insert today's dateCTRL + ; to insert today's date
102024, Jan 0816:0018:002:00Adult Education WorkshopML
112024, Jan 0916:0018:002:00ML
122024, Jan 2216:0018:002:00ML
132024, Jan 2916:0018:002:00ML
142024, Jan 3016:0018:002:00ML
152024, Feb 0516:0018:002:00ML
162024, Feb 0616:0018:002:00ML
172024, Feb 1216:0018:002:00ML
182024, Feb 1316:0018:002:00ML
19
Sheet1
Cell Formulas
RangeFormula
D7D7=SUMIFS(D10:D100,A10:A100,">="&C7,A10:A100,"<="&EOMONTH(C7,0))


will be on dropbox for a few days
 
Upvote 0
Solution
Thanks a ton! I have to get the dates formatted correctly, but this will work great.
You don't happen to know how to change the date format for an entire workbook do you. The workbook I'm trying to fix has several tabs at the bottom for letters of last names (A-Z). There are several names on each tab. Each date column has different date formats. I don't want to have to go through and select each range manually and then change the format.
But regardless, thanks again!
 
Upvote 0
you are welcome
No, I dont know how to do that - other member may and even have some VBA code to do that

Worth starting a new question/thread asking that

Also its worth updating your profile with the version of excel you are using - as new versions have a lot of new functions
 
Upvote 0

Forum statistics

Threads
1,225,487
Messages
6,185,270
Members
453,285
Latest member
Wullay

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