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
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
so I have created a leaver tracker for our employees in an excel file.
Background: Each sheet represents each month (ie: Jan, Feb, Mar, etc.) which includes the following information:
** Note: This file is a template I downloaded from Google.
I have created another sheet which outlines the following: Note: these are sample data.
Question: What formula can I use to count the number of Sick Days (S), Annual Leavel (H) and Half Days (HA) separately for all 12 months across all sheets with 1 formula?
If I understand well, you can do this:
Without macro
Write a first sum formula in each sheet (after the last day)
In your Dashboard, write a sum formula from the previous sheet formula
or:
Write a marco to do it
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 working on a workbook that tracks monthly numbers, and also provides a yearly and quarterly summary for those months. The workbook has a Fiscal Year sheet, four quarterly sheets (named Q1-Q4), and 12 sheets for the months (Jul, Aug, Sep, Oct, etc). All of sheets in this workbook look identical.
Completing most of the Fiscal Year sheet is fairly simple, just use the formula =SUM(Jul:Jun!B3), which looks at all 12 monthly sheets and sums cell "B3". No problems there.
However, we have a backlog section that shows how far behind we are. For this number on the Fiscal Year sheet, I just want the number from the latest month of data. Since it's not a cumulative sum of all the months before, it's causing me issues.
I need a formula that will find the last non-blank cell in those 12 monthly sheets (they are in fiscal year order), and return just that cells value. The range for that formula would be Jul:Jun!B17. So if March is the last months worth of data, and the backlog number for march is 56, I want 56 to show on my Fiscal Year sheet.
I tried using
=LOOKUP(2,1/('Jul:Jun'!B17<>""),B17)
But it becomes this
=LOOKUP(2,1/('Jul:[June]June'!B17<>""),B17)
And returns a #REF! error. Any ideas?
Thanks!
If I interpret your question correctly, then the following Array formula will give you what you seek: =INDEX(A1:A16,MAX(IF(ISNUMBER(A1:A16),ROW(A1:A16),""))).This can be put in A17 for July and copied across the row to L17 for June.
Ahhh,I see.The following formula is a bit cumbersome, but solves what you are trying to accomplish.I would imagine that using VBA would be more direct and simpler, but in your example of effort you used formulas so I take it that you prefer a formulaic answer :
=CHOOSE(MAX(IF(Sheet1!B17>0,1,0),IF(Sheet2!B17>0,2,0),IF(Sheet3!B17>0,3,0),IF(Sheet4!B17>0,4,0),IF(Sheet5!B17>0,5,0),IF(Sheet6!B17>0,6,0),IF(Sheet7!B17>0,7,0),IF(Sheet8!B17>0,8,0),IF(Sheet9!B17>0,9,0),IF(Sheet10!B17>0,10,0),IF(Sheet11!B17>0,11,0),IF(Sheet12!B17>0,12,0)),Sheet1!B17,Sheet2!B17,Sheet3!B17,Sheet4!B17,Sheet5!B17,Sheet6!B17,Sheet7!B17,Sheet8!B17,Sheet9!B17,Sheet10!B17,Sheet11!B17,Sheet12!B17)
I am creating a Table in excel to help determine what the Bi-annual dates would be from an input date.
Example: If the start date of an agreement is 9/1/2017 and Ends 8/31/2018, the Bi-annual dates would be 2/28/18 and 8/31/2018. Dates of service would be 2 months before the end of the agreement period, and six months before the second service date (so 6/30/2018 and 12/31/2017 respectively).
Formula for this:
=IF(ISBLANK(O3), "",IF(EOMONTH(A1, 0)=EOMONTH(O3, -2), "BIANNUAL", IF(EOMONTH(A1, 0)=EOMONTH(O3, -8), "BIANNUAL", "")))
Where A1 refers to January, B1 would be February, and so on thru to December (L1). O3 is the Agreement End Date box, and will be static on the sheet. This formula work perfect for me.
What I am trying to get is a formula for the cells at the top that list the months (Jan-Dec). I need a formula that will put the date as 1/31/2018 for Jan, 2/28/2018 for Feb, 9/30/2017 for September (for the current year since September has not passed). The actual day needs to be the last day of the month, and if that month has passed, then the year should be for next year. I have been playing with the DATE function, but cannot get it nailed down.
What I have so far - January 2018:
=DATE(YEAR(TODAY()+365), MONTH(42766), DAY(EOMONTH(42766, 0)))
This works, but not each month will be in 2018. I need the year to change only after the month has passed.
I feel like I'm either over complicating things, or I need a way more complex formula. Please help.
In A1 place the following formula and copy right to L1 or as far as you need to go
=EOMONTH($O$2,COLUMN(A1)-1)
It will display the end of month dates starting with the starting month of the contract and increasing by 1 month for each column you move right.
In the image below, it is the same formula in row 1 and row 2. Row one I choose custom format instead of date and set the custom format to mmmm. 4 m's will give you the full month, and 3 m's will give you the 3 starting letters of the month.
I actually figured this out this morning just playing with the IF function. My goal was to have the sheet update itself without having to change the dates every time your open it. So that the file could be shared with others and all you would have to enter is the end of the contract date, and it will list out Biannual, Tri-annual, and Quarterly months (see image).
Formula:
=IF(DATE(YEAR(TODAY()), MONTH(42766), DAY(EOMONTH(42766, 0)))<TODAY(), DATE(YEAR(TODAY()+365), MONTH(42766), DAY(EOMONTH(42766, 0))), DATE(YEAR(TODAY()), MONTH(42766), DAY(EOMONTH(42766, 0))))
Where I used the serial for each month (in this case 1/31/2017, as I didn't need to worry about the year)
Results