# Calculate number of hours worked in a month

Options
edited 12/09/20

I have one sheet where I am going to track the number of hours worked on a project. The individual will put the hours in and date worked. In a roll up sheet I am trying to calculate the number of hours worked per month

Sheet 1

Sheet 2

In column3 and am trying to add up the number of hours worked(used) for Dec 2020 and each month after.

Any help is greatly appreciated

• Options

This appears to be a format issue. Date format for a single cell isn't working. While my column on sheet 1 is formatted as date, I cannot format the reference cell on sheet 2 as a date so the formula is not working. I created another column, formatted as date and it works.

• Employee
Options

Yes, in order for the Date column in your first sheet to be recognized in a formula you would either need the referenced cell in your second sheet to also be in a Date Type of column, or you can use different functions in your formula to convert numbers into dates.

For example, you can search for a specific month by using the MONTH function and looking for a number.

December would be: MONTH(@cell) = 12

I would suggest wrapping this specific function in an IFERROR as well, in case it comes across blank cells.

IFERROR(MONTH(@cell), 0) = 12

Then you can use this as your criteria in a SUMIF statement (instead of referencing a cell):

=SUMIF({Date Column}, IFERROR(MONTH(@cell), 0) = 12, {Total Hours column})

You'll need to adjust it per-column to look for a different month, so for January:

=SUMIF({Date Column}, IFERROR(MONTH(@cell), 0) = 1, {Total Hours column})

Keep in mind this doesn't account for the Year, so I would suggest having an "archive" sheet where you can move rows that are no longer a part of your Sheet 2 calculations so that your formulas only look at the correct month/year.