COUNTIF formula using variable dates - excel

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!

Related

Hour calculation based on date 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.

Count worktime for current month only

I would like to ask for a bit of help, as I can't figure it out myself.
What I would like to end up is, get the total calculation of the work time hours for each name only for the month written in A5 cell.
So far I used this code to have the start date Monday, based on the date in A5 cell.
=A5-MOD(A5-2,7)
With this community help I ended up with this code to count the work time for each name in the week (lots of students in the schedule)
=SUMPRODUCT(IFERROR(TIMEVALUE(MID(C7:H7,FIND("-",C7:H7,1)+1,LEN(C7:H7)-FIND("-",C7:H7,1))) - TIMEVALUE(LEFT(C7:H7,FIND("-",C7:H7,1)-1)),0))
The help I need, if it's possible, is to figure out how to get the total work time only for the month entered in cell A5 (which is 1.october - 31.october) without counting the last 3 days in September. I plan to use this spreadsheet for the following months as well. I tried to use COUNTIFS, but no luck so far. Also, I am using an online excel version, which is very limited in the menu.
Thanks in advance for any help.
=TEXT(c6, "mmm") will give Sep, while TEXT(A5, "mmm") will give Oct. You need to SUMIF the month matches.
You could incorporate this together with the equation you already have but I think it might be easier to create a duplicate table below the main table, copying the day of the month and the names and using your above mentioned equation to get the hours to be summed.
Either above or below the date, or instead of the date, I'd pull out the month with =TEXT(C6, "mmm")
Lets say the duplicate table for cells B16-I12 was in cells B106-I112 with the extra row specifying the month above this in row 105 (=TEXT(C106, "mmm") etc.).
Then in cell D24, you'd have
=SUMIF(C$105:I$105,TEXT($A$5,"mmm"),C107:I107) +[same again for the next week, cells B15-I21] + [same again for the next week] etc.
This can then be copied down for all the names.
You could also feed this information up into cells K7, K8,K12, becuase you only need this for the first and last months. So J6 would read 'hours this week' K6 would read Hours last month, L6, hours this month. Then D24 could sum L7 and J16 etc.

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))

Retrieve cell value based on date Excel

I'm working on a time sheet for my work schedule. In column A I have the start dates of each week. In the second column I have how many hours I work that day. I am payed on the 22nd of each month. I want to have a running total of how much I have earned in a month before payday. That is to say on the 21st I know how much money I will be paid the next day from my spreadsheet.
I want to SUM the values of column B but only for the weeks which lie between the 22nd of 'April' lets say and 'May'.
Therefore based on the value of the start date of the week, I need to obtain the information adjacent to the weeks, for a set of weeks and sum it to find the number of hours I've worked this paying month. I want this to happen automatically, so it will change automatically.
I have attached a screenshot which might make this clearer, I have added a couple of other names as additional variables.
Thank you in advance,
Maksim Richards
If the amounts that you'll get in next month's pay haven't been filled in yet (which is the question you're asking because you want to find out on 21st May how much you will be getting) then you just need to sum the amounts for the weeks starting 22/4/16 onwards in G9:-
=SUMIF($A$4:$A$11,">="&DATE(YEAR($F$2),MONTH($F$2)-1,$G$2),B$4:B$11)
where today's date is in F2 and payday in G2.
Then the pay so far is:-
=G9*24*$H$2
where the hourly rate is in H2 (result may appear formatted as date: if so, change format to general).
If you wanted to check back after some of next month's hours had been put in the spreadsheet and see if what you've actually been paid is the same as your calculated pay you would need a SUMIFS:-
=SUMIFS(B$4:B$11,$A$4:$A$11,">="&DATE(YEAR($F$2),MONTH($F$2)-1,$G$2),$A$4:$A$11,"<"&DATE(YEAR($F$2),MONTH($F$2),$G$2))
I haven't used TODAY to get today's date because it's volatile and if you use it, it will keep prompting you to save the spreadsheet when you close it even if you haven't changed anything.

How do I count how many occurrences per week something happens excel?

I am looking at a rather large excel spreadsheet with a long list of dates on it. Each one of these dates marks an error. What I am trying to find out is how many errors occur per week? From there I hope to make a control chart. Thanks so much and please let me know if there are any additional details I need to provide.
Just Like TMH8885 metioned get week number from each date and then assuming that your dates are in Column A and weeknumbers are in column B make a table that list numbers from 1 to 52 next to which enter a COUNTIF(B:B,D2)(change D2 to cell pointing at correct week number of course).
In the screen shot I was lazy and included only 22 weeks for my table.
You could use the WEEKNUM function to pull which week of the year the error occurred in.
=WEEKNUM(your date cell)
From there you could use a pivot table to pull in the weeks then find the average count of errors.

Resources