Hour calculation based on date excel - excel

I've got a question where I don't know were to start to be honest.
I want to add a function to my sheet where I calculate the total amount of hours based on the date.
So as for my example I want excel to recognize the different dates, regardless of their position, and calculate the amount of hours spent on that date.
Is that something that is even possible?
Or is it impossible and is that the reason why I can't find anything about it?
little note: I'm using excel 2016
29-06-2021 update
got it working with both SUMIFS and SUMIF using the following formula:
=SOMMEN.ALS(B234:B332; A234:A332;"28-06-21")
the current challenge I'm facing is that I want excel to look up the date and determine the day
I already tried with VLOOKUP (with a calendar on another sheet) but that doesn't seem to work
Excel has to use the date in the date column to determine which day it is so I can determine the amount of hours per weekday.
example VLOOKUP
Obviously I'm doing something wrong, but I don't know what

I got it running with specifying multiple criteria in the SUMIF function
I now use the following formula for Mondays which basically is a list of all Mondays in a year
=SOM(SOM.ALS(A218:A316;{"04-01-21”;”11-01-21”;”18-01-21”;”25-01-21”;”01-02-21”;”08-02-21”;”15-02-21”;”22-02-21”;”01-03-21”;”08-03-21”;”15-03-21”;”22-03-21”;”29-03-21”;”05-04-21”;”12-04-21”;”19-04-21”;”26-04-21”;”03-05-21”;”10-05-21";"17-05-21";"24-05-21";"31-05-21";"07-06-21";"14-06-21";"21-06-21";"28-06-21";"05-07-21";"12-07-21";"19-07-21";"26-07-21";"02-08-21";"09-08-21";"16-08-21";"23-08-21";"30-08-21";"06-09-21";"13-09-21";"20-09-21";"27-09-21";"04-10-21";"11-10-21";"18-10-21";"25-10-21";"01-11-21";"08-11-21";"15-11-21";"22-11-21";"29-11-21";"06-12-21";"13-12-21";"20-12-21";"27-12-21"};B218:B316))
SOM=SUM and SOM.ALS=SUMIF in English versions
This works for me, it just takes some time to get all the dates in the formula.

Related

Comparing Month with date(MM/DD/YR)

Is it possible to compare a month number with a date(MM/DD/YR) in Excel/Google Sheets?
For example, according to the screenshot, I just want to calculate the weekly time only in September and not August. I want it to be general so whatever month I choose, it will only calculate the hours for that month and not other months that is displayed on the table. I think the way to approach the problem is writing an if statement where if the DATE column starts with "9", then it will only calculate that row, and ignore the other rows that is not a 9.
I am just not sure if we can compare multiple cells to see if it matches with a certain month.
all you need is:
=SUM(FILTER(B1:B7, MONTH(A1:A7)=8))
You could use SUMIFS in both Excel or Google Sheets:
=SUMIFS(E2:E8,A2:A8,">="&F10,A2:A8,"<="&EOMONTH(F10,0))
Adjust ranges (and make them absolute if need be)

How do I sum a total number of occurrences of a ID number with a specific month and year in Excel

I have a Excel Master sheet where I am looking to query other sheets within the workbook. What I am trying to do is see How many occurrences of an ID for a Project in a column occur within a month, e.g. how many times does the ID 1367 occur in November. My dates are in the format of e.g 13/11/18 and this cannot be changed as I am just creating a report against a workbook I do not own.
The relevant columns I need are formatted like so:
Project: Project ID: Date:
a 123 1/01/2018
a 123 2/01/2019
a 123 3/01/2018
a 123
This is my SUMIFS function:
=SUMIF(PPlanner!$D:$D,Dashboard!$B$6,PPlanner!X:X)
This works by itself. My problem is trying to get the ID total for a specific month.
It returns the number of occurrences the ID occurs against a project all together but not against the month specifically. I have tried adding syntax to specify
the month but I am getting errors such as "too many arguments".
I recently answered a question that was very similar :
Excel - Take Average of Monthly Data
I think this would answer your question as well, but you have to use COUNTIFS instead of AVERAGEIFS
As for presentation, I would make a separate list of the months you want to include, and put the formula next to it, instead of the formula next to the actual list of data (as in the other question). As for how to write/input the month, you can put it any way you want, as long as it is a valid date in Excel. With the cell formatting you then can show it as month and year only. This is just to say that a text input JANUARY 2018 does not work (in a normal cell, eg. a cell that you did not format as text, when you type that into the cell, Excel recognizes this as a date, and will actually put 1/1/2018).
Oh, and using a Pivot table would work as well, the other answer on the question referenced above also explains how to do that.
In some cases, how Excel handles dates is very convenient.
For you, the date format doesn't matter. It is simply a number counting days with 0 being December 31st, 1899.
13/11/18 the date is the integer 43417 in-cell value. Excel interprets this as a both date and time together. The whole numbers are the days while the decimals are the time of day as a fraction of the day. 43417.5 would be noon.
So you may use COUNTIFS to help here.
=COUNTIFS(PPlanner!$X:$X, 1367, PPlanner!$D:$D, ">"&43404, PPlanner!$D:$D, "<"&43435)
This is going to look at sheet PPlanner column X and count how many instances of 1367 occur after the last day of October and before the first day of December. There are other ways to accomplish this, but it allows you to count within any date range you want.

How to compare two dates and take one that is smaller? e.g MIN for DATE

This question is for educational purposes only, as I have already solved this problem in a way I dislike...
Sheet looks following and has rows for months, in each row there is a column for days that month and for current month
I have a formula that calculates how many days have passed this month or month that has passed which is used in some later calculations.
=TODAY()-DATE(2017,6,1)+1
Currently at the end of month I have to go and change formula to (as they go over 31 day in a month)
=DATE(2017,5,31)-DATE(2017,5,1)+1
What I would like to do is something like:
=MIN(TODAY(),DATE(2017,6,30))-DATE(2017,6,1)+1 to take whichever date is less, so I could do the formulas for the months in advance and not need to go back to it at the end of every month...
I can do it like =MIN(TODAY()-DATE(2017,6,1),DATE(2017,6,30)-DATE(2017,6,1))+1 but it looks somewhat not nice...
How do I compare two dates and take one that is smaller?
After a chat room discussion, it appears that one problem was the formatting of the results.
So =MIN(TODAY(),DATE(2017,6,30))-DATE(2017,6,1)+1 is sufficient
Excel stores dates as serial numbers with 1 = 1-Jan-1900.
If one wants to return a date, the cell containing the formula should be formatted as a date.
If one wants to return a numeric value, the cell containing the formula should be formatted as General or as a number with the appropriate number of decimals.
Excel does not always format the cell as desired by the user, so this may need to be edited.
Days passed for that month is nothing but the day. You can directly use the below formula, I believe.
=min(day(date(2017,6,30)), day(DATE(2017,6,4)))
if you want that as a date. Then you can include another date function to include month and year. If you just want the smaller date itself, then you can directly use the date itself in the min function
=min(date(2017,6,30), date(2017,6,4))
You have TODAY() function to get today date, you can get this month by MONTH function in excel.
TODAY() - DATE(2017, MONTH(TODAY()), 1) + 1
reference
If you want to know how many days have passed, can't you just use
=TODAY()-(EOMONTH(TODAY(),-1)+1)

Excel: Trying to count cells based on date, can't figure out SumIf

hopefully you can help me with this. I've been trying to figure it out in Excel myself, but I can't make the functions work and it's causing me to manually count the cells.
I've created a sample sheet on Google to show roughly what I'm trying to do;
https://docs.google.com/spreadsheets/d/18bFBvtbK-3JDj6Z6_b6NHttaytApNvdfw92ZcI4ECws/edit#gid=0
I have a series of tests my personnel have to take annually, and I want to write a function that displays the total number of tests taken within the past year. Cell B1 would be the column title, B2-4 would display the date the test was taken, and B5 is where I want the number of dates in B2-B4 that are less than one year old.
Any ideas?
If you want less than a year old from todays date then just count all values that are greater than 365 days ago,
=COUNTIF(B2:B4, ">"&(TODAY()-365))

COUNTIF formula using variable dates

Morning all,
Let me explain my predicament! I'm putting together a set of reporting figures for my employer based on a spreadsheet containing work that's been completed so far this year. I need to report on the total volume of work completed and the average turnaround for this work, split by Week to Date, Month to Date, and Year to Date (WTD, MTD, YTD).
This is something i've put together manually so far but i want to produce a formula which allows my employer to generate his own figures based on a week-ending date he can pick from a dropdown list (held in cell D4).
So far i've been able to generate the below COUNTIF formula to give me the WTD figures for work volumes completed within 7 days of the week ending date in cell D4 (with the completion date being held in 'Completed!O:O'):
=COUNTIFS(Completed!$O:$O,">="&D4-6,Completed!$O:$O,"<="&D4+1)
I'm also using the below AVERAGEIF formula to show the average turnaround (the Turnaround figure is held in 'Completed!P:P'):
=AVERAGEIFS(Completed!$P:$P,Completed!$O:$O,">="&D4-6,Completed!$O:$O,"<="&D4+1)
I've been trying to come up with similar formulas to tell me the MTD and YTD figures but with no success. I originally had the MTD formula return the value based on work completed within 31 days of the Week-Ending date but this was incorrect. If the week-ending date of 03/02/2017 if selected then i only need it to show the count of work completed between the 1st and 3rd of Feb. I'm sure once i work this one out that i'll be able to use a similar formula to show me YTD figures.
Any help or guidance you can offer is appreciated! Cheers.
For the MTD count, use:
=COUNTIFS(Completed!$O:$O,">="&DATE(YEAR(D4),MONTH(D4),1),Completed!$O:$O,"<="&D4+1)
For the YTD count, use:
=COUNTIFS(Completed!$O:$O,">="&DATE(YEAR(D4),1,1),Completed!$O:$O,"<="&D4+1)
For the MTD average, use:
=AVERAGEIFS(Completed!$P:$P,Completed!$O:$O,">="&DATE(YEAR(D4),MONTH(D4),1),Completed!$O:$O,"<="&D4+1)
For the YTD average, use:
=AVERAGEIFS(Completed!$P:$P,Completed!$O:$O,">="&DATE(YEAR(D4),1,1),Completed!$O:$O,"<="&D4+1)
a fellow helpful user has assisted and i now have formulas that work.
For MTD, i'm using the following:
=COUNTIFS(Completed!$O:$O,">="&EOMONTH(D4,-1)+1,Completed!$O:$O,"<="&D4+1)
And for YTD:
=COUNTIFS(Completed!$O:$O,">="&DATE(YEAR(D4),1,1),Completed!$O:$O,"<="&D4+1)
Thanks for everyones help!

Resources