I can't find anything in the archives of answered questions that addressed this.
I'm pretty good with Excel but this is frustrating me.
I've been tasked with improving the tool that our office staff uses to track regular hours, OT hours, and various paid leave.
I have a great start on the whole thing but because the company pay periods are bimonthly (1st to 15th and 16th to EOM) I'm running into difficulty automatically calculating the OT hours to pay when the work week (for the OT) spans two pay periods.
I have a column that shows the day of the week (Monday = 2, Tuesday =3, etc.) and I was trying to figure out how to look at the Day column and calculate all instances of Day2-Day6 hours to get OT hours (if any-I have a formula for that)to pay in the current pay period. I need to look backwards at the beginning of a new pay period if the new pay period does not start on Monday.
The spreadsheet has the prior pay period as well as the current pay period laid out.
I would sure appreciate any advice.
Have a lovely day - Lynda
Here is the data:
DayofWeek; Date; StartTime; EndTime; Lunch; Hours#Work; FringeType; FringeHours; TotalPayHours; WeeklyOTHrs (these are the column headers)
5 Thursday, March 16, 2017 7:30 17:00 1 8.50 8.50
6 Friday, March 17, 2017 8:00 16:30 0.5 8.00 8.00 12.00
2 Monday, March 20, 2017 7:30 17:00 1 8.50 H 8 16.50
3 Tuesday, March 21, 2017 8:10 16:30 1 7.33 7.33
4 Wednesday, March 22, 2017 8:00 17:00 1 8.00 V 8 16.00
5 Thursday, March 23, 2017 8:00 17:30 0.5 9.00 9.00
6 Friday, March 24, 2017 7:40 17:00 1 8.33 8.33 1.17
I now have a formula in the OT cells:
=IF($B30=6,IF(SUM(G26:G30)>40,SUM(G26:G30)-40,""),"")
Here are two options that might be helpful, both use the SUMIFS function. The first option needs less code, but requires that the start and end dates of the respective period are defined in cells outside the data table.
Option 1.
If you're only interested in the total for each pay period, you could skip the OT column and instead calculate the total outside the data table. Here's an example with only 3 columns. In the screenshot, B5 contains the following formula:
=SUMIFS($C$12:$C$33,$A$12:$A$33,">="&$B$3,$A$12:$A$33,"<="&$B$4)
SUMIFS sums all values in column C if they are within the dates of the previous period as specified in cells B3 and B4.
Similarly, B9 contains a formula for the current period, as defined by cells B7 and B8:
=SUMIFS($C$12:$C$33,$A$12:$A$33,">="&$B$7,$A$12:$A$33,"<="&$B$8)
Option 2.
If you want to track accumulated OT hours in each period, you can keep the OT column and add a variation of the formula above. In this example I have included two extra columns to define the start and end of the period (this makes the formula prettier; if you don't want extra columns, these formulas can be incorporated into the formula in column D).
In this screenshot, D3 contains the following formula:
=SUMIFS($C$3:$C3,$A$3:$A3,">="&E3,$A$3:$A3,"<="&F3)
This is essentially the same formula as in option 1, but the range increases for each row, so that D4 contains:
=SUMIFS($C$3:$C4,$A$3:$A4,">="&E3,$A$3:$A4,"<="&F3)
Also, the start and end dates of the period are dynamic and contained in columns E and F. The formulas check if the current date is in the first or second half of the month, and adjust the start and end dates accordingly.
Start date (cell E3):
=IF(A3<=DATE(YEAR(A3),MONTH(A3),15),DATE(YEAR(A3),MONTH(A3),1),DATE(YEAR(A3),MONTH(A3),16))
End date (cell F3):
=IF(A3<=DATE(YEAR(A3),MONTH(A3),15),DATE(YEAR(A3),MONTH(A3),15),EOMONTH(A3,0))
Note: If you want to avoid extra columns, you can incorporate columns E and F into D, so that cell D3 would contain:
=SUMIFS($C$3:$C3,$A$3:$A3,">="&IF(A3<=DATE(YEAR(A3),MONTH(A3),15),DATE(YEAR(A3),MONTH(A3),1),DATE(YEAR(A3),MONTH(A3),16)),$A$3:$A3,"<="&IF(A3<=DATE(YEAR(A3),MONTH(A3),15),DATE(YEAR(A3),MONTH(A3),15),EOMONTH(A3,0)))
Related
I have a DateTime column in Excel in which data is sorted in ascending order based on DateTime conditions from 15th June to say 1st November ;
I want to print Week Number from 1st to Nth Week based on date condition; Week criteria are like first seven days i.e 15th June to 21st June is Week1, 22nd Jun-28th Jun is Week2, 29th June - 5th June is Week3 and so on.
How Can I do this?
Column1
06/15/2021 8:00
06/15/2021 10:00
:
:
11/01/2021 20:44
11/01/2021 20:46
Let's assume your list of dates is in A2:A.
Place the following formula in cell B2 of an otherwise empty range B2:B...
=ArrayFormula(IF(A2:A="",,ROUNDDOWN((INT(A2:A)-INT(A2))/7)+1))
INT is just removing the times from date-times.
The rest is really more of a math/logic question than a formula question.
I have two dates. Now my aim is to calculate the number of days, month wise for n number of rows
Input:
start date 22/01/2019
finish date 21/06/2019
Output & result should be
January February March April May June
9 28 31 30 31 21
for many rows.
Excel or VBA Excel formula both will be great,
Thanks in advance....
Here is a screenshot of my Excel table:
https://ibb.co/tC38jzs
Here is a simple solution if your Active Month column entries are not the names of the month, but the last day.
31.01.2019 28.02.2019 ...
For the January column you can then use
=MAX(0, MIN($AV14-$AT14, AY$13-$AV14))
and for the other months you have to subtract the days aggregated since January. Here for February:
=MAX(0, MIN($AV14-$AT14, AZ$13-$AV14) - SUM($AY14:AY14))
Expand the last formula from Feb to Dec.
I have a Pivot Table that I am able to cycle through the different months based on a Month Filter (changing the data of the table). I am trying to calculate based off of that change of value. I am recording the amount of times a license is used in a workday. The number of workdays in a month change based on the month. I calculated out the workdays for each month using
=NETWORKDAYS(H34,EOMONTH(H34,0),J34:J45)
H34 references my 1/1/2016 date. J34:J45 references my holiday dates to avoid.
I am trying to write a formula that says "If the month listed (from my month filter) within the Months list then to print the corresponding Workdays value.
=IF(G34:G46=H48, I34:I46)
It only works on January. The rest of the values return False. I do calculate it as an Array Function. It returns either False. I cannot think of another function that could replace it. Any help would be appreciated.
2016
Month Date Workdays Holiday Dates Holidays
January 1/1/2016 19 1/1/2016 New Year's day
February 2/1/2016 20 18-Jan Holiday 2
March 3/1/2016 22 2/15/2016 Valentines day
April 4/1/2016 21 3/25/2016 St. Patrick's Day
May 5/1/2016 21 5/30/2016 Memorial Day
June 6/1/2016 22 7/4/2016 Independence Day
July 7/1/2016 21 9/5/2016 Labor Day
August 8/1/2016 23 10/10/2016 Holiday
September 9/1/2016 22 11/8/2016 Columbus Day
October 10/1/2016 21 11/11/2016 Veteran's Day
November 11/1/2016 21 11/24/2016 Thanksgiving
December 12/1/2016 21 12/26/2016 Christmas
All 235
Selected Month
March FALSE
The VLOOKUP() function will greatly simplify this process for you. This particular function is great for extracting values in a list based on a key lookup field.
In your example, you want to easily extract the value from Holiday Dates column based on an input month.
A few things to keep in mind for the input parameter functions in this function:
The first column in your table array must contain the lookup value, in this case, the month column.
If may need to lock your array dimensions, use the $ sign in front of the column letter and row number.
FALSE should be selected for the range_lookup in order to do exact matching for the lookup value. If you choose false, you may get false positivies.
Every row in your list should be unique for the lookup value. Let's say January was listed twice, the value returned would be for the first occurrence.
Additional info:
http://spreadsheeto.com/vlookup/
http://www.howtogeek.com/howto/13780/using-vlookup-in-excel/
You can use the LOOKUP function, as follow:
=VLOOKUP(G48,G34:I45,3)
This formula looks up "G48" value in column G (first matrix column), and returns the value from column I (third matrix column) that is in the same row.
Read this official Office page for more details.
Please, give us your feedback.
I'm looking for a formula in excel that will give me a current 12 month table. For example this month is April. I want a formula that gives me 12 months back from April in the exact format as show in the table below. For next month it will be May, and 12 months back from may without having to adjust any dates.
Month
5/1/2015
6/1/2015
8/1/2015
9/1/2015
10/1/2015
11/1/2015
12/1/2015
1/1/2016
2/1/2016
3/1/2016
4/1/2016
Thank you
Try this and copy down 11 rows
=EDATE((TODAY()-DAY(TODAY())+1),ROW(A1)-12)
If you number the months in column b starting from b2 =0 to b13=11
And row 1 has headers
A2 formula =EOMONTH(today(),b2-1)+1
A3 formula = EOMONTH(today(),b3-1)+1
Etc.
EOMONTH will give you the last day of any month. So if we start with today() it will give you the last day of the current month, but if we count back 1 month (b2-1). It will give you the last day of last month. So we add 1 day to it and you get the first day of each month.
Hope this helps :)
I'm looking for a formula that will let me get a weekly total of a daily totals column during partial weeks at the end month for Excel 2010. Using the US week of Monday-Friday.
I have a Day(A), Date(B), Daily Total(J) and Weekly Total(N) column for one month. I'd like to show the totals for the week (M-F) either on Fridays, or the last day of the month. For full weeks, if the Day="Fri", I can sum column J by using a 5 cell range like $J11-$J15 which would sum the daily totals from Monday thru Friday of a full week in the middle of the month.
That doesn't work for a partial week at the beginning, so I have modified versions for the first 5 days, if a Friday is detected and that seems to work. I'm open to other ideas if there's a better way to handle the first week.
--------------------------------------------------------------------
A B J (N) Week
1 Day Date Total Total Formula for Column N Week Total
2 Thu 1/1/2015 1 =IF($A2="Fri",$J2,"")
3 Fri 1/2/2015 2 3 =IF($A3="Fri",SUM($J$2:$J3),"")
4 =IF($A4="Fri",SUM($J$2:$J4),"")
5 =IF($A5="Fri",SUM($J$2:$J5),"")
6 =IF($A6="Fri",SUM($J$2:$J6),"")
--------------------------------------------------------------------
A6/N6 would be the last possible Friday for the first 5 days of the first week, so the rest of the formulas, until towards the end of the month are similar to:
N7 would be =IF($A7="Fri",SUM($J3:$J7),"")
N8 would be =IF($A8="Fri",SUM($J4:$J8),"")
It handles summing a 5 day full week, in the middle of the month, and only shows the weekly total in column N for Fridays.
I don't know how to handle the last week since it could be a partial week of between 1-4 weekdays, not ending on a Friday. I still want show a total for that last partial week, on the last weekday of the month.
I thought about checking to see if the days in the last week were either Friday or the end of the month, and came up with a check for either "Fri" or the end of the month. For example in January day 31 would be:
(N32) =IF(OR($A32="Fri",EOMONTH($B$2,0)=$B32),SUM($J28:$J32),"")
That works if and only if, the 31st is a Fri, but doesn't work if Jan 31st is a Mon-Thurs since the range to sum is fixed at 5 days ($J28:$J32) and I don't know how to make it variable, based on how many days are in that last week of the month.
I would appreciate your ideas on how to do a monthly report where it can show weekly totals for full or partial weeks. The "plan" is to have 4 empty master workbooks to use for months with 28, 29, 30 and 31 days since I don't know how to make it all purpose and not screw up borders.
Thanks!
Does your data include Saturdays or Sundays? I'm assuming not. If not then you need to check whether the date is the last workday of the month....or a Friday.....and you could just sum everything in column J up to that point and subtract the column N totals form above, i.e. in N2 copied down
=IF(B2="","",IF(OR(A2="Fri",MONTH(WORKDAY(B2,1))<>MONTH(B2)),SUM(J$2:J2)-SUM(N$1:N1),""))
I assume N1 will contain a text header