How to calculate accumulated vacation days in Excel based on days (and hours) worked per month? - excel

TLDR: I need a way to track date values in a dynamic calendar and count the days I've worked on on a monthly base.
So I've made a dynamic calendar (in the 1904 Date system to enable negative time handling) to help me track days and hours worked in Excel that has some automatic features. I would now like to add a calculator to calculate the accumulation of vacation days based on the following conditions:
Days worked per month >= 14
OR
The total hours worked per month >= 35
If one or both of these conditions are met I will receive 2 vacation days (2.5 after the 1st year of employment) and the accumulated vacation days should be shown in a single cell C7 (see picture for reference).
I know that I need to calculate the days that I've worked on on a monthly base and compare the result to the 1st condition (and the same for the worked hours and compare the result to the 2nd condition, but the solution for that is much the same as for the 1st condition). I've made my calendar in a way that I can't use fixed cells to do the calculation, as the length of the calendar is fixed to 53 full weeks and the dates change to accommodate the length according to the year in cell C2 i.e. January 1st will not always be in cell D17. Here are the first 10 rows of my dynamic calendar in Table Markdown format with the formulas as asked.
Year
2023
Quota
=SUM(J11:J375;'2022'!C2)
Hours per week
37.5
Gross working days
=NETWORKDAYS(DATE(C2;1;1);DATE(C2;12;31);'1pyhapaivat'!B7:B21)
Net working days
=COUNTIF(H11:H381;">0")
Vacation Accumulation
Kilometers per day
36
Week No.
Date
Day
Start
end
Hours
Sum
Quota
Kilometers
Holidays
Note
=ISOWEEKNUM(D11)
=SEQUENCE(371;1;DATE($C$2;1;1)-WEEKDAY(DATE($C$2;1;1);2)+1;1)
=D11
=IF(M11="quota";-7,5/24;IF(G11>F11;IF((G11-F11)>(6/24);(G11-F11)-(0,5/24);(G11-F11));""))
=SUMIF(H11:H15;">0")
=I11-COUNTA(G11:G15)(($C$4/5)/24)-COUNTIF(M11:M15;"quota")(($C$4/5)/24)
=COUNTA(F11:F15)$C$8-(SUM(COUNTIF(M11:M15;"Remote");COUNTIF(M11:M15;"Office"))$C$8)
=XLOOKUP(D11;_1pyhapaivat3[Start Date];_1pyhapaivat3[Subject];"")
A snippet of the dynamic calendar
I've tried combining the DATE and SUM functions with other functions like COUNTA, and COUNTIF. I've also tried using different LOOKUP functions but to no avail.
The new dataset filtered by Year
And filtered again by Month

Related

MS Excel sorting formula

Microsoft money used to be a brilliant programme for keeping track of a pension portfolio in that it showed value change weekly, monthly, 3 monthly and year to date, now it is no longer supported I have been trying to find an alternative. I now have an I Mac with MS excel on but am trying to do a sort and display on the following and try keep track as per MS Money did.
[Sample][1]
This data is updated weekly and would like to know if it is possible to replicate MS Money.
[1]: https://i.stack.imgur.com/BLahL.png
ok so lets try the things you said about and see if we can get you close:
name the ranges (link) dates and values
weekly movement (current value / value 1 week ago):
=SUMIF(dates,MAX(dates),values)/SUMIF(dates,MAX(dates)-7,values)
1 month movement:
=SUMIF(dates,MAX(dates),values)/SUMIF(dates,MAX(dates)-ROUND((MAX(dates)-EDATE(MAX(dates),-1))/7,0)*7,values)
3 month movement:
=SUMIF(dates,MAX(dates),values)/SUMIF(dates,MAX(dates)-ROUND((MAX(dates)-EDATE(MAX(dates),-3))/7,0)*7,values)
ytd:
=SUMIF(dates,MAX(dates),values)/SUMIF(dates,MAX(dates)-ROUND((MAX(dates)-DATE(YEAR(MAX(dates)),1,1))/7,0)*7,values)
this assumes those named ranges and that the date is exactly every 7 days apart. if also looks for the closest date to 1 month ago, 3 months ago and start of year.
also it does a current value as percentage of the start value for the period

Calculate the time between two dates, excluding business hours and holidays

How to calculate the time between two dates, excluding business hours and holidays, using Excel or in Salesforce platform?
Assuming the earlier date is in A1 and the later in B1 then:
=24*(B1-A1-1)-8*(NETWORKDAYS(A1,B1)-2)-16*(NETWORKDAYS(A1,B1)-2 -(NETWORKDAYS(A1,B1,holidays)-2))
I have not condensed the above as you may wish to make adjustments.
The part starting 24* is the total number of hours (excluding shifts in clocks) between the two dates. Between does not count either -after the earlier and before the later.
The part starting 8* is the total number of hours that are to be excluded on the basis that they are working hours. Here I have assumed an eight hour day. What counts as a weekend (standard non-working days) is as decided by Microsoft. For more flexibility about that use NETWORKDAYS.INTL, if available.
The part starting 16* is the total number of hours to be excluded (that have not already been) on the basis that they are holidays. These days are calculated as the difference between working days assuming no holidays and working days excluding holidays, with the latter excluded through the optional third function parameter which here is a range named holidays.
The result I get from A1 = 31/12/2014 and B1 = 12/01/2105 is 192, assuming Saturdays and Sundays are weekend days and 1/1/15 is in holidays, which may be calculated as four weekend days (96 hours) plus six work days (#16 hours = 96).

Excel function to create due dates that land on a business day

I'm stuck creating a formula that will calculate days before the end of the month then adjust to make sure it is a business day. For example: 30 days before 6/30/2015 is 5/31/2015 which is a Sunday. I need that to adjust to the Friday before.
I'm working on finding the due dates of a number of documents that are due a certain number of days before another date. For example: documents are due 30 days before the last day of the month. However, the number of days varies and the due date needs to fall on a business day (Monday-Friday). Sometimes it's 30 days, sometimes it's 60 days, sometimes it's 30 calendar days + 5 business days, etc.
I've been able to calculate 30 days + 5 business days with the following formula:
=workday(start_date-30,-5)
Any ideas how to adjust this so that I can just have the due date be 30 calendar days before a certain date but also always be a business day?
Using WORKDAY you can use a formula like this:
=WORKDAY(A1+B1+1,-1)
where A1 is your start date and B1 the number of days to add.
You probably need to write a macro function or maybe some nested IF statements in your cell's formula.
Take a look at http://www.mrexcel.com/forum/excel-questions/481558-round-date-nearest-workday.html
That solution moves forward to the nearest workday, but the principle is sound: just subtract instead of add.

Excel Subtracting periods from specific dates using 360-day calendar?

Got formulas for figuring my differences between date periods in days as follows:
=IF(F7="","0",DAYS360(F6,F7)+1)
This gives the days result for each period that I am interested in, but I then need to add each period of days together and subtract them from a current date (like doing service computation). The issue is that I need to do this second calculation within a 360-day calendar as well. If I just try to do a days360() formula with one value being the current date and the other being the total number of days that I need to backtrack, then the "original" date that it comes up with is drastically off.
This seems to be the equivalent of the difference between NETWORKDAYS and WORKDAY functions. The former counts working days between two dates, the latter adds working days to a date, you essentially want the WORKDAY equivalent for DAYS360, which I don't think exists.
You can manipulate DAYS360, though, e.g. with a date in A2 and number of days to subtract (in 360 day mode) in B2 you can use this formula for the date
=A2-B2-MATCH(B2,INDEX(DAYS360(A2-B2-ROW(INDIRECT("1:"&CEILING(B2/30,1))),A2),0),0)

Elapsed Days Hours Minutes Excluding Weekends and Holidays Time

This sounds simple but I have been pulling my hair out trying to figure out a solution. Any help before I go bald would be great.
I need a formula which is able to
calculate the duration in (days, hrs, mins) between two date\time values (eg 05/12/2012 5:30 PM and say 07/12/2012 5:45 PM);
excluding weekends and holidays.
I would like the result of the formula to read as follows "e.g 2 Days 0 Hrs and 15 Mins".
Thanks
Link to sample workbook
You can use NETWORKDAYS and NETWORKDAYS.INTL to achieve this
A bit of manipulation is required as these return net whole days:
Use these functions to calculate the number of non workdays, then subtract from the difference between start and end dates
=E3-D3-(NETWORKDAYS.INTL(D3,E3,"0000000")-NETWORKDAYS(D3,E3,$A$16:$A$24))
This returns the working day difference, where 1.0 = 1 day
NETWORKDAYS.INTL(D3,E3,"0000000") calculates whole days between the two dates (no weekends, no holidays)
NETWORKDAYS(D3,E3,"0000000",$A$16:$A$24) calculates whole working days days between the two dates (Sat/Sun weekends, holidays as per your list in $A$16:$A$24)
Difference in non-working days between the two dates.
E3-D3 is time between start and end date/times (1.0 = 1 day)
Use custom number formatting to display thye result in the format you require
d "Days" h "Hours" mm "Mins"
Note: this format won't work for negative values, you will need an alternative for when end date is before start date.
The following formula works like a treat with no additional formatting or manipulation.
To make it more stable I have turned all the holiday dates for UK 2012/13 into ‘Excel Serial Number’ format and placed them in an array bracket.
Replacing the "D5" in the formula with your cell reference for your course or metric "End Date" and "E5" with your course or Metric for "Completion Date".
=IF(E5<D5,"-"&TEXT(D5-E5,"h:mm"),NETWORKDAYS(D5,E5,({40910,41005,41008,41036,41064,41065,41148,41268,41269,41275,41362,41365,41400,41421,41512,41633,41634}))-1-(MOD(E5,1)<MOD(D5,1))&" days "&TEXT(E5-D5,"h:mm"))

Resources