how calculate from endate amount of days excluding holidays - excel-formula

Hi does anybody has good idea about how calculating backwards day from end date with respect to workdays?
Lets say we know Deadline 30thNovember activity to be done. We know that we need 20 working days for activity to be performed. So how can we calculate latest start date for activity in respect to saturdays/sundays, if not Vacationdates or holidays?
I.e. Backwards logic of =WORKDAY(A2,B2)

Screenshot/here refer:
=B13+B6-SUM(1*(B9:B10>=B13)*(B9:B10<=B13+B6))
Notes:
Falls down if holiday coincides with new end date or start date

Related

Excel - Bi-Weekly Tasks - Fill Calendar

I have a Task month calendar. when i change the month of the calendar it shows me what I have to do which day of the month.
I basically have a list of task, when i change the month the tasks date automatically change accordingly a series of rules and that list will populate the calendar.
Calendar
Tasks
But I have some tasks that are bi-weekly, and I dont have a specific week to be done, they have to be done in the fortnight after the last time.
so I have the first week (day) that the task was done and i have the first day of the month i am... and with that i would wanted to know which days of the month i have to do that specific task.
Can you help me?
use the last reference point as the basis for creating the next due date. this would be the date the task was last performed. If it is due a fortnight from that last date then add 14 days. You may want to record the date that task was performed each time so that your formula is based on the date it was last completed each time it is calculated.
If you are wanting to plan ahead then make an assumption that it will be done in consistent 14 day iterations then build your formula to consider the actual date it was completed to readjust the plan going forward. So it will assume this will be done consistently until advised otherwise with an actual date it was last completed.
The trick is to get the first date in the month that matches the weekday of the last date and then you can easily add 14 days. Much like finding the first Monday/Sunday in a month to build a calendar.
A1 contains the last time the task was performed
C1 contains the 1st of the month
C1+7-WEEKDAY(C1+7-weekday(A1))
will return the next weekday that matches the weekday the task was last performed.
=C1+7-WEEKDAY(C1+7-weekday(A1))-A1
returns the number of days since
=(C1+7-WEEKDAY(C1+7-weekday(A1))-A1)/2
returns the number of days divided by 2. If this result is not a whole number (#.5) then it's not in the bi-weekly cycle and we need to add another 7 days to get the correct start date. If it is a whole number then it is our start date. We can use the mod function to find out if there is a decimal value.
=if(mod((C1+7-WEEKDAY(C1+7-weekday(A1))-A1)/2,1)>0,C1+7-WEEKDAY(C1+7-weekday(A1))+7,C1+7-WEEKDAY(C1+7-weekday(A1)))
Below or next to this cell you can simply reference the cell and add 14 =D1+14 and then add as many as you want to display.

Calculate annual leave between two dates in Excel

This task seems easy enough yet I just can't figure a way of doing this without resorting to vba.
All I need is to know the number of hours an employee has used up on annual leave, based on a start and end date, and their hours of work.
To be more clear, this example shows one employees contracted hours from Monday to Sunday i.e. they work only Weds, Thurs, and Friday, for 7.5 hours each day.
Below shows the start and end date that the employee has chosen to take for annual leave. I need to calculate, based on their contracted hours, how much annual leave is used between the two dates. The answer would be 45 hours in this case.
Here's another approach - I've expanded the days between the start and end dates into an array then used the resulting day numbers to offset into the days of work range
=SUMPRODUCT(N(OFFSET(A3,0,WEEKDAY(ROW(INDIRECT(A6&":"&B6)),2)-1)))
If you had a list of holiday dates somewhere (say in I3:N3) you could exclude them as follows
=SUMPRODUCT(N(OFFSET(A3,0,WEEKDAY(ROW(INDIRECT(A6&":"&B6)),2)-1))*ISNA(MATCH(ROW(INDIRECT(A6&":"&B6)),I3:N3,0)))
- it is a bit long-winded but the only way I can think of at the moment.

How to get number of days between two dates in nodatime

I need to compute the number of days between two dates using NodaTime, and to do it in a timezone.
The end time is date based with an implied time of midnight at the end of the day. This date is in a timezone.
The start time is the current time, but I am passing it into the function so that the function is testable.
I tried using Period, which seems like the obvious answer, but Period is too granular on one end (when we are on the end day) and not granular enough when we are more than 1 month away.
So if Now is July 9, 5:45pm in America/Toronto and the End Time is Sept 1, 00:00:00, then I would like to be able to calculate 54 days. (assuming I counted the number of days on my calendar correctly. :) )
I figured I would have to handle the sub day problem myself, but it surprised me when I had to figure out how to handle the greater than a month problem.
Is there an obvious way to get the number of days between two times from NodaTime? I have it down to three lines of code using .Net's DateTime and TimezoneInfo classes, but I want to move to NodaTime for all the reasons specified on the site.
Thanks
I should have read the Arithmetic section of the docs more closely before posting.
You can specify which unit you want the math result to be in with a 3rd parameter. Here is what I needed:
Period timeLeft = Period.Between(nowInTz.LocalDateTime, endDate, PeriodUnits.Days);
this is from the docs:
http://nodatime.org/unstable/userguide/arithmetic.html
Hope this helps somebody else in the future.

How do I calculate a date by adding 30 calendar days, where end date must be business day?

I'm wondering if this is possible. I am creating a spreadsheet to track project due dates. Each project must be completed by the 30th calendar day, but must be turned in on a business day.
Currently, I am just adding 30 days to the start date but this means some due dates aren't always accurate. For example, if the 30th day is Saturday, April 2nd, then the real due date would be Friday April 1st.
Is there a way to construct a conditional such that the due date equals the 30th calendar day, unless that falls on a weekend / holiday, where it then falls on the next earliest business day?
I've been struggling to figure out a way to do this.
For English settings in Excel, with a date in A1, in B1 enter:
=IF(TEXT(A1+30,"DDDD")="Sunday",A1+28,IF(TEXT(A1+30,"DDDD")="Saturday",A1+29,A1+30))
This simple-minded approach only handles Saturdays and Sundays, not arbitrary holidays.
I would prefer more elegant way like using WORKDAY.INTL
=WORKDAY.INTL(A2+31,-1,1,E2:E)
Explanation: start date + 31 days (1 day more than maximum calendar days)
then subtract 1 working day - going to last previous working day
Reason: because this formula does know when are weekends (by using variables) and also knows to skip hollydays by a custom list.
here is an example sheet you can use
Revised after comment:
Try this:
=(A4+30)+CHOOSE(WEEKDAY(A4+30),1,0,0,0,0,0,-1)
Your date, in A4, + 30 days, then add an amount of days until the next workday. If A4 + 30 is a Saturday it will subtract 1 day, a Sunday will add 1.

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.

Resources