In 2002, Thanksgiving was on the 28th of November. So two working days before Monday, Dec 2nd should be Wednesday Nov 27th.
But
WORKDAY(A1,-2) Where the cell A1 has the value 12/2/2002 stored
gives me 11/28/2002
Is there a command or option that keeps track of the days financial markets are closed in the US?
No, but =WORKDAY can be modified to take account of days to exclude to suit.
Syntax is WORKDAY(start_date,days,holidays)
Holidays is an optional list of one or more dates to exclude from
the working calendar, such as state and federal holidays and floating
holidays. The list can be either a range of cells that contain the
dates or an array constant of the serial numbers that represent the
dates.
Related
I have the following data
Hire Date Termination Date
1/28/2019 4/16/2019
2/18/2020
9/17/2018 3/12/2020
I need to find how many active employees the company had for each month. So far, I tried the formula below, and it came pretty close. But I need accurate numbers.
{=SUM((IF('Employee Roster'!C$2:C$5000<>"",'Employee Roster'!C$2:C$5000,"")<=EOMONTH(A38,0))*(IF('Employee Roster'!D$2:D$5000="",1E+100,'Employee Roster'!D$2:D$5000)>EOMONTH(A38,0)))}
For the formula, Employee Roster C is the hire date, A38 is the Month column in my final table, Employee Roster D is the Termination Date.
At the end, I wish my final table to look like below
Month Active Employees
February 2019 100
March 2019 129
April 2019 150
...
Construct a list of all the month start dates of interest.
In O365, you can use the formula =EDATE(EOMONTH(MIN(Hires),-1)+1,SEQUENCE(DATEDIF(EOMONTH(MIN(Hires),-1)+1,EOMONTH(TODAY(),0),"m")+1)-1)
In other versions, you could construct a list of months manually.
and it will SPILL down as far as required. But there are other ways to create this list, even manually.
In the adjacent cell to the first month, enter the formula:
=SUMPRODUCT((IF(Termination="",TODAY(),Termination)>=A2)*(Hires<=EOMONTH(A2,0)))
and fill down as far as required.
Algorithm
If a person is an employee during a given month, then
His termination date must be after or equal to the start of that month
If there is no termination date, it is set to TODAY()
His hire date must be equal to or prior the end of that month
In the screenshot, I formatted the month as m/d/yyy so as to emphasize it needed to be the first of the month; but you can format it as mmmm yyy to match your desired report requirement
I have a headcount data structured in the following way.
Data Structure:
Every month I append one dataset to another by pasting values in the first empty row in one main sheet.
1a. Therefore, one employee can be included in the sheet for more than one time.
There is a column that tells me if the person left the company this month or if he got hired.
I want to have an executive summary with a comparison of two months. I managed to have this working with a static data month over month (so for instance to have a walk from July to August, October to November, etc.) with using countifs.
Question:
I would like to have a dynamic selection in my summary sheet.
if I select January in one cell and September in another, the formulas will calculate how many hires and leavers were there from January until September.
If I select February in once cell and July in another, the formulas will calculate how many hires and leavers were there starting from February until July.
This is the exact formula I have for calculating Month Over Month change: =COUNTIFS(SSE_Reporting!$R:$R,MoM_Walk!$A5,SSE_Reporting!$AH:$AH,MoM_Walk!H$4,SSE_Reporting!$AK:$AK,MoM_Walk!U$1)
Please keep in mind below:
My dataset contains information starting January 2019 until today (and will be increased)
In the executive summary, I may want just to have the view from March 2019 until December 2019 (therefore, in this case, countifs will not work, because it will count either ALL leavers or just leavers for ONE specific month)
You could do a COUNTIFS to count how many Leaver/Hire you got in a given date range.
Something like this could guide you to deploy your own formula:
My formula in H4 is:
=COUNTIFS($A$2:$A$28;H$3;$B$2:$B$28;">="&$F4;$B$2:$B$28;"<="&$G4)
As you can see, it works perfectly to count the criteria on multiple given date ranges.
COUNTIFS
function
I have daily data from 01-Jan-2005 till 29-Dec-2017. I want for each year to select the last day of March, June, September, and December, alongside their respective data. Part of the data:
Date Variable
30-Mar-2005 1.2943
31-Mar-2005 1.2964
1-Apr-2005 1.2959
4-Apr-2005 1.2883
5-Apr-2005 1.281
I.E: For 2005, I want the dates of 31-March-2005, 30-June-2005, 30-September-2005, and 30-Dec-2005. Desired output:
Date Variable
31-Mar-2005 1.2964
30-Jun-2005 1.9859
30-Sep-2005 1.2233
30-Dec-2005 1.2814
I currently have the build in excel formulas (i haven't installed any other plug-ins etc).
More specifically: on the left i have the data, and on the right the desired output.
Not sure if this is going to work to you, but anyways.
Looks like you always look at the last day of months March, June, September and December on a specific year (in example, 2005).
But you are not looking for the last natural day of each month. You want the last day of each month that appears in your data (in example, that explains why you use 30 december 2005 instead of 31, because there is no 31).
In Excel, dates are numbers. The more you go in the future, a bigger number is related. Knowing this, you can get the date for each month just looking the MAX value of a range of dates.
But first, you need to define the range of dates, using 2 conditions:
Month of date must be March, June, September and December
You want dates for a specific year (in example, 2005).
To get this, you need an array formula. My formula gets the max day of a specific month and year. To test it, in my Excel I did a dates series, starting in 01/01/2005 and done in 31/12/2017. I deleted manually 31/12/2005 because that date has no data.
In cell I4, just type the year you want to check. The formula will get he last day of months March, June, September and December of that year.
My array formula is:
=MAX(IF(MONTH(IF(YEAR($A$4:$A$4750)=$I$4;$A$4:$A$4750))=3;$A$4:$A$4750))
IMPORTANT!: Because it is an array formula, you will need to type it
as usual, and then, instead of pressing Enter press
CTRL+SHIFT+ENTER
You need 4 times this formula. Just change the 3 (March) for the number of the month you need (6,9 and 12).
Now that you have the dates, you just need a VlookUp to get the value you want.
=VLOOKUP(G5;$A$4:$B$4750;2;false)
If I change the year value, i get those new values:
If you want to check the file. I uploaded an example to Gdrive, so you can download if you want.Download
Anyways, try to adapt this formulas to your needs.
I converted a list of Euro conversions into a Table and used structured references. But you can use normal range references if you prefer.
In some other table, enter the following formula, where $A$45 refers to the first quarter ending date in your data table.
F2: =IF(EOMONTH($A$45,(ROWS($1:1)-1)*3)>MAX(Table1[Date]),"",LOOKUP(2,1/(EOMONTH($A$45,(ROWS($1:1)-1)*3)>=Table1[Date]),Table1[Date]))
In the adjacent column, enter the formula:
G2: =IFERROR(VLOOKUP(F3,Table1,2,FALSE),"")
And fill down until you get blanks.
(in my sample table, the last date is 1/27/2006 so the last included "End date" is 12/30/2005, there being no data for 12/31/2005)
So, there are two cases
When you have the exact last days of the month. (Its simpler).
I had a fortnightly data. I adopted this simple and innovative method. From all the dates, I first extracted the day using Day() function. for example, Day(A1). (Remember, while doing this, do not delete your original date column. Do it in a separate column as this would help you match the dates later).
Then I sorted the data using the Day column, just constructed before, in decreasing order. This would place all end dates at first. And then deleted the starting dates which were at bottom. So, now I am left with only end dates but obviously months are not in order.
So, create another column extracting just the month and year from the original date column using =MONTH(A1) & "/" & YEAR(A1). Sort the data using this column. And, you are good to go!
When you do not have the exact last days, but maximum dates like the one shown above in picture.
In this, while deleting the initial dates, you would have to take care of which date on-wards you need to delete.
For example, I deleted day 17 on-wards of months with 31 days (including day 17) and day 16 on-wards of months with 30 days (if present) because if there was this date, suppose, 18 April 2018, then this would be the last day of the month as I had a fortnightly data.
I'm setting up a spreadsheet to calculate dates based off of one trigger date. If one of the subsequent dates is not a Tuesday, Wednesday, or Thursday, I need Excel to find the date of the next Tuesday. (In my office, certain meetings can only happen Tuesday through Thursday, so if the calculated date falls on a Monday or a Friday, I'd like Excel to give me the next Tuesday.)
I'm trying to use IF and WEEKDAY together, and I'm pretty sure something is wrong with how I wrote the "or" logic. Here's what I have:
=IF(WEEKDAY(D9,1)=NOT(OR(3,4,5)),D9+7-WEEKDAY(D9+7-3),D9)
But the formula returns false every time and gives me the date in the cell itself.
With a date in A1, use:
=CHOOSE(WEEKDAY(A1),A1+2,A1+1,A1,A1,A1,A1+4,A1+3)
(almost as easy as a VLOOKUP())
=IF(MOD(A1-1,7)>2,A1+2-MOD(A1-1,7)+7,A1+2-MOD(A1-1,7))
A1 is your trigger date
I need a formula that gives me the YTD workday count for each month.
For example:
If today is 8/6/2015 - the workday count should be 17 (excluding weekends)
If today is 9/3/2015- the workday count should be 18 (excluding weekend and 1 holiday)
Thanks,
This is just the native Excel function:
=NETWORKDAYS(TODAY(),DATE(YEAR(TODAY()),MONTH(TODAY()),31))
Note that you will need to choose a set of holidays to exclude from the working days function, and define that as a Name in the Formula Ribbon -> Name Manager. ie:
=NETWORKDAYS(TODAY(),DATE(YEAR(TODAY()),MONTH(TODAY()),31),CustomHolidays)
Where CustomHolidays has been defined as a name which means:
={02/14/2015;03/15/2015;...}
You need NETWORKDAYS between the first of the month, and the last of the month.
Assuming your date is in A2, first of the month is simple, A2-DAY(A2)+1. Last of the month is harder as it could be 28, 29, 30 or 31. Youy can use EOMONTH to get this though, EOMONTH(A2,0)
Put it all together
=NETWORKDAYS(A2-DAY(A2)+1,EOMONTH(A2,0))
As has been commented, you can also include holidays if you wish to exclude these.