Count worktime for current month only - excel

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.

Related

Pull named range from cell value

I have a spreadsheet used to generate monthly job cards. I need to set it up so it "knows" which month it's on, and on which day number a Monday falls. To this end I have set it up that each day number for every monday this year is listed. Each line on the daily task jobcard is serial numbered from 1 to 28,30, or 31 dependant on the month, so I have set up a formula to check the serial number for the daily task against the day number of each Monday. It works and I have checked this, but the only issue I have is that the formula (=IF(COUNTIF(MARCH23MON,AJ6)>0,$AK$4,$AK$5)) requires me to change the MARCH23MON to match the range for each month up to 31 times every month.
Is there a way to do something like if the date = the date listed in cell a1, then use the value of cell b2 as the range (i.e. MARCH23MON).
See the screenshot here to see how I have begun to set this out. The date for each month is defined by the user in cell C3 when they generate the job cards for the upcoming month, this is then copied into cell AJ2 and formatted to match the dates in AP3:AP14.
I'd like to have the date defined in AJ2 to define the range the formula in AN6:AN36 uses from those listed in AO3:AO14, so that each month is checked against the relevant range of dates.
I had attempted to just use a vlookup then reference the output in this formula =IF(COUNTIF(MARCH23MON,AJ6)>0,$AK$4,$AK$5) as follows =IF(COUNTIF($AL$2,AJ6)>0,$AK$4,$AK$5) which obviously doesn't work. I tried it as ADDRESS($AL$2) but again no worky. Not sure if it is possible.
Foxfire and Burns And Burns mentioned the CHOOSE function in a comment, and that has resolved this for me. Instead of using the list of range names I am now using CHOOSE
to select the dates of each month's Mondays from individual lists. I get the value of AL2 from a VLOOKUP function.

N-Count Days For Changing Dates For Ecommerce Shipment Sheet

I have to submit a daily MIS for orders which are Undelivered For less then 2 Days, Undelivered Between 3-5 Days and 5+ Days.
Currently i'm doing this manually by counting from the Purchase Date forward. So e.g. for an order of 11th March, i'll just count 2 days till 13th (If undelivered) and type 1 in front of the column and do a count manually of all orders outstanding in each column.
The problem arises as the column descends and the dates get further and further away from current day.
This is tiresome but i can't seem to find an algorithm that can do this automatically.
Can anyone help please.
Consider this screenshot:
Cell A1 has the date you want to compare to. Don't user the Today() function, since it is volatile and can slow down the workbook. Just manually put in the desired date.
The formula in cell E2 is
=IF(D2="undelivered",IF($A$1-C2<=2,"less than 2",IF($A$1-C2<=5,"3 - 5 days","5+ days")),"")
In words: if the status is "undelivered", calculate the difference between purchase date and A1. If it is less than 2, return that text, if it is less than 5, return that text, otherwise return the third text.
Copy that formula down.
In cells G3 to G5 you see each of the three texts and next to it is a formula. Starting in H3
=COUNTIF(E:E,G3)
copied down to H5.
Your layout may differ, so you will need to adjust the formulas accordingly.

Auto populating the 31st day of a given month in excel

I am building a template for a data entry spreadsheet at work for some of the old-timers. The template that they will see will be columns of categories and the rows will be dates including the day of the week. I know how to auto-fill the date an day by drag and drop, but honestly some of these guys even screw that up. So, I am building this spreadsheet that auto populates the date and the day for the whole month based on entering the first day of the month that way its as simple as possible, but I am having trouble with the 31st day of some months. I don't want to have two different spreadsheets. Right now the code that I have is:
=EOMONTH(A5,0)
This works if it is the 31st day of the month, which is great, but if it is not a month that has 31 days it repeats the 30th day. I'd really like it to be an if statement, but I know my code is off because it always generates a FALSE.
Is =if(A5(M<2),"EOMONTH(A5,0)") heading in the right direction? It generates a #REF! reponse with that code.
Thank you for any input!
In A5 enter the date of the first day of the month. In A6 enter:
=A5 + 1
and copy downwards.
In A35 enter:
=IF(DAY(A34+1)=1,"",A34+1)
This assumes that you are making the date sequence by adding 1 to the cell above.
EDIT#1:
Put this in A6:
=IF(A5="","",IF(DAY(A5+1)<DAY(A5),"",A5+1))
and copy downwards through A35.
This will handle long months, short months, leap years, etc.
(this also has the advantage of maintaining the same formula for the entire set of cells)
You just need to add an IFERROR before the IF to fix the February problem:
=IFERROR(IF(DAY(A34+1)=1,"",A34+1),"")

Excel Date table to determine next Bi-annual date from Input date

I am creating a Table in excel to help determine what the Bi-annual dates would be from an input date.
Example: If the start date of an agreement is 9/1/2017 and Ends 8/31/2018, the Bi-annual dates would be 2/28/18 and 8/31/2018. Dates of service would be 2 months before the end of the agreement period, and six months before the second service date (so 6/30/2018 and 12/31/2017 respectively).
Formula for this:
=IF(ISBLANK(O3), "",IF(EOMONTH(A1, 0)=EOMONTH(O3, -2), "BIANNUAL", IF(EOMONTH(A1, 0)=EOMONTH(O3, -8), "BIANNUAL", "")))
Where A1 refers to January, B1 would be February, and so on thru to December (L1). O3 is the Agreement End Date box, and will be static on the sheet. This formula work perfect for me.
What I am trying to get is a formula for the cells at the top that list the months (Jan-Dec). I need a formula that will put the date as 1/31/2018 for Jan, 2/28/2018 for Feb, 9/30/2017 for September (for the current year since September has not passed). The actual day needs to be the last day of the month, and if that month has passed, then the year should be for next year. I have been playing with the DATE function, but cannot get it nailed down.
What I have so far - January 2018:
=DATE(YEAR(TODAY()+365), MONTH(42766), DAY(EOMONTH(42766, 0)))
This works, but not each month will be in 2018. I need the year to change only after the month has passed.
I feel like I'm either over complicating things, or I need a way more complex formula. Please help.
In A1 place the following formula and copy right to L1 or as far as you need to go
=EOMONTH($O$2,COLUMN(A1)-1)
It will display the end of month dates starting with the starting month of the contract and increasing by 1 month for each column you move right.
In the image below, it is the same formula in row 1 and row 2. Row one I choose custom format instead of date and set the custom format to mmmm. 4 m's will give you the full month, and 3 m's will give you the 3 starting letters of the month.
I actually figured this out this morning just playing with the IF function. My goal was to have the sheet update itself without having to change the dates every time your open it. So that the file could be shared with others and all you would have to enter is the end of the contract date, and it will list out Biannual, Tri-annual, and Quarterly months (see image).
Formula:
=IF(DATE(YEAR(TODAY()), MONTH(42766), DAY(EOMONTH(42766, 0)))<TODAY(), DATE(YEAR(TODAY()+365), MONTH(42766), DAY(EOMONTH(42766, 0))), DATE(YEAR(TODAY()), MONTH(42766), DAY(EOMONTH(42766, 0))))
Where I used the serial for each month (in this case 1/31/2017, as I didn't need to worry about the year)
Results

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