Conditional formatting in Excel for weekend/holiday work - excel-formula

I am using an attendance tracker template to track "X" employee for sick days, late days, etc... I currently have a "Total Working Days" as well as a "Days Worked" entry calculated using the NETWORKDAYS function as well as a custom rule for saturdays and sundays to be excluded [ OR(LEFT(C$5,1)="S" ]. We offer weekend/holiday work, and would like to add that to the total days worked if an employee works extra, but am having issues getting that specific saturday or sunday (or normal holiday) to count on that specific employees total days worked. Is there a logic statement that I can add somewhere to auto populate that day as a valid working day for the NETWORKDAYS function?calendar viewlist of attendance issues
I have tried moving different types of attendance issues to different days of the week, and can only get them to count on normal working days. I have also changed the custom rule for weekends to a normal day of the week (Fridays), which then counts the weekend work, but omits anything on any Friday. I am looking for an overlaying logic function to count any weekend work entered as a valid work day for that employee, and add it to the totals at the bottom either with a custom rule or through the NETWORKDAYS function.

Related

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

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

Excel formula for entering bi-weekly dates

I have the following worksheet:
The grid is filled with the following formula (this example is from cell H4) that populates the grid based on inputs from the table on the left, =IF($A4="","",IF(AND($E4="Daily",H$2>=$D4,H$2<=$G4),IF(RIGHT($F4,2)="30",LEFT($F4,LEN($F4)-2)&"/",IF(RIGHT($F4,2)="00",LEFT($F4,LEN($F4)-2),$F4)),IF(AND($E4="Weekly",H$2>=$D4,H$2<=$G4,TEXT(H$2,"DDD")=TEXT($D4,"DDD")),IF(RIGHT($F4,2)="30",LEFT($F4,LEN($F4)-2)&"/",IF(RIGHT($F4,2)="00",LEFT($F4,LEN($F4)-2),$F4)),IF(AND($E4="Bi-Weekly",H$2>=$D4,H$2<=$G4,MOD($D4+14,H$2)=0),IF(RIGHT($F4,2)="30",LEFT($F4,LEN($F4)-2)&"/",IF(RIGHT($F4,2)="00",LEFT($F4,LEN($F4)-2),$F4)),IF(AND($E4="Monthly",H$2>=$D4,H$2<=$G4,TEXT(H$2,"MM/DD/YYYY")=CONCATENATE(TEXT(H$2,"MM"),"/",TEXT($D4,"DD"),"/",TEXT($D4,"YYYY"))),IF(RIGHT($F4,2)="30",LEFT($F4,LEN($F4)-2)&"/",IF(RIGHT($F4,2)="00",LEFT($F4,LEN($F4)-2),$F4)),IF(COUNTIF('PowerPoint Gantt'!$A$5:$A$12,$A4)=1,IF(H$2=VLOOKUP($A4,'PowerPoint Gantt'!$A$5:$E$12,5,FALSE)+31,"R",""),""))))))
The only part of the function that isn't working is the Bi-Weekly selection. I can't figure out how to get recurring entries. I can get the start date and one 14 day period after. I've tried using the CEILING function also but still only gets me the next 14th day marked, instead of every 14th day. And ideas?
In your rule for Bi-Weekly meetings, it seems that
MOD($D4+14,H$2)=0
should be replaced with
MOD(H$2-$D4,14)=0
The latter takes the difference between the starting date and the actual date and checks to see if that can be divided by 14, the number of days in 2 weeks.
Your rule for Weekly meetings could be approached similarly, which seems simpler to me than a rule based on the name of the day, like you are using now.

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.

COUNTIF only if header of column contains specific text

I am trying to write a function in excel (without using vba/macros if possible), to count the number of remaining work days for each employee for the month, from the first of the month to a date I enter into A1. The problem is, the scheduling file I use starts on a Monday every time, so if the month begins on a Friday, there are 4 days from the previous month on the page and the same could happen at the end of the month if the month doesn't end exactly on a Saturday.
In row 6, I have the dates (formatted as 28-Sep-2015), and from rows 9 and below, I have employee names and whether or not they're scheduled to work on the days directly above in row 6. I'm looking to count the number of times the word "WORKING" appears in the row for each given employee, but only to count it if the header in row 6 contains "Sep". I don't want to count any times "WORKING" appears if it comes from the past month or the upcoming month. (Also, no one works Sundays, so Sundays are skipped.)
I'll try to show an example of set up here.. hopefully it can help:
A1: 28-Sep-2015
A6-H6: Employee, 28-Sep-2015, 29-Sep-2015,30-Sep-2015, 1-Oct-2016, 2-Oct-2016, 3-Oct-2016
A9-H9: George, WORKING, OFF, WORKING, WORKING, WORKING, WORKING
So for this small example, the result should only be 2 working days, since George only works twice from 28 Sep to the end of the month.
I've been searching for how to do this for a few days now, but nothing seems to work when I try it. Please help!
If you are using 2007 and later than use this:
=COUNTIFS($A$6:$G$6,"<="&EOMONTH($A$1,0),$A$6:$G$6,">="&DATE(YEAR($A$1),MONTH($A$1),1),$A9:$G9,"=WORKING")

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