I am planning to add a simple formula to calculate the sum for each individual based on month (i.e. cell C14). If I change the month to March, then sum should be taken from Jan to Mar and if I change the month to December, then sum should be taken from Jan to Dec for that particular person.
I am currently using the follwoing formula, but it is coming too big. I have just added from Jan to Apr only and it is coming this long. I don't want such a big formula. Is it possible to change it to very simple formula?
=IF(C14="Jan",VLOOKUP(A17,$A$3:$M$11,2,0),IF(C14="Feb",VLOOKUP(A17,$A$3:$M$11,2,0)+VLOOKUP(A17,$A$3:$M$11,3,0),IF(C14="Mar",VLOOKUP(A17,$A$3:$M$11,2,0)+VLOOKUP(A17,$A$3:$M$11,3,0)+VLOOKUP(A17,$A$3:$M$11,4,0),IF(C14="Apr",VLOOKUP(A17,$A$3:$M$11,2,0)+VLOOKUP(A17,$A$3:$M$11,3,0)+VLOOKUP(A17,$A$3:$M$11,4,0)+VLOOKUP(A17,$A$3:$M$11,5,0)))))
Try this
B17: =SUM(OFFSET($A$2,MATCH(A17,$A$3:$A$11,0),1,1,MATCH($C$14,$B$2:$M$2,0)))
and fill down as needed.
I'm not sure if I can come up with a non-volatile formula.
In the above, we use the MATCH function to compute both the row offset into the table; as well as the width of the returned array.
Related
I am trying to come up with an Excel Formula to calculate 6 Months average value from Monthly prices.
A year is considered from April 2022 to March 2023 and so on. That means from April 2022 to Sept 2022 it is Half 1 and Oct 2022 to Mar 2023 it is Half 2.
Total time line is till March 2055. So, the formula has to be dynamic.
Please advise how I can use a formula for this averaging task.
The Data table look like below.
INPUT
Please refer the link to picture
OUTPUT
In Yellow in the picture below
Table Pic
Thank you!
It would be fairly simple if we had 'regular' half-year periods. Since half-years are shifted 3 months forward, we also need to shift the formula by three months. To achieve that, we have an OFFSET function that we can apply for the prices row. It will work fine for all the half-year periods with the exception of the first one since we'll have the prices range shifted. So, for the first half of 2022 in the cell B9 we will simply write =AVERAGE(B5:G5) and for all the rest, starting from C9, -
=AVERAGEIFS(OFFSET($B$5:$OG$5,0,3),$B$1:$OG$1,C7,$B$2:$OG$2, IF(C8=1,"<="&6,">"&6))
assuming that the months start in column B like in your example picture and finish in column OG as suggested from your task description.
If you want rolling 6mo periods, I prefer INDIRECT to OFFSET.
Assume the data runs vertically, each month is a separate row, and "X" is the cell of the latest value, this should work:
=AVERAGE(INDIRECT(ADDRESS(ROW(x), COLUMN(X))&":"&ADDRESS(ROW(X)-5, COLUMN(X))))
I have a sheet where I would like to count the unique days. What I mean by that is, the data covers 1 Jan 2017 to 31 Dec 2017, but not all dates are included. When autofiltered, even less days are showing. I have tried many different formulas I have been given, but they all fall over when the sheet is autofiltered for the required criteria. The closest one was an array formula, entered in Excel for Mac 16.43. It was entered using Ctrl & Shift & Enter
=SUM(IFERROR(IF(FREQUENCY(A3:A5524,A3:A5524),IF(SUBTOTAL(3,OFFSET(A3:A5524,ROW(A3:A5524)-ROW(A3),0,1)),1)),0))
It counts the correct number of days when the sheet is unfiltered, the number changes as the sheet is autofiltered, but again becomes incorrect when this is done. There might be a date range showing of 6 Jan 2017 to 20 June 2017, but only have 75 actual days showing in that range; nothing I have yet tried can get it accurate after autofiltering
The data is laid out in a pretty standard way with column A being date and it is formatted as Date and dd/mm/yyyy
Hopefully someone can suggest something which works
The answer ended up being the following
=SUM(IF(FREQUENCY(IF(SUBTOTAL(3,OFFSET(A3:A5524,ROW(A3:A5524)-ROW(A3),0,1)),A3:A5524),A3:A5524),1))
Rather than the original formula
cheers
Array formula
=COUNT(0/FREQUENCY(IF(SUBTOTAL(2,OFFSET(A2,ROW(1:5522),)),MATCH(A3:A5524,A3:A5524,),),ROW(1:5555)))
Note parameter, if column A is a date, the use of 2, if column A is text, using a 3, but FREQUENCY unavailable.
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 a list of names from rows 2 to 10 and Months names in columns from Jan to Dec. There are values in numerics from cell B2 to end.
I have a drop down list cell in another sheet containing months names.
I want to get the sum of values according to the month selected. For e.g. If June is choosen in drop down list, sum of values from Jan to June for that particular name should be calculated and shown in that cell. I want to get using Sum and vlookup function. Another e.g. if April is choosen, sum of values from Jan to April must be calculated for that particular name. I am providing a link to the images so that you can get a detailed view of my data.
https://drive.google.com/folderview?id=1z2tG-jU849BxCVFwHkOEfyYAOa5oatHe
INDEX/MATCH would be better suited:
=SUM(INDEX(B:B,MATCH(P2,A:A,0)):INDEX(A:M,MATCH(P2,A:A,0),MATCH(Q2,1:1,0)))
One option is to use OFFSET function, e.g.
=SUM(OFFSET(B1,MATCH("barry",A2:A10,0),0,1,MATCH("May",B1:M1,0)))
....or if you really want to use VLOOKUP try this:
=SUMPRODUCT(VLOOKUP("barry",A2:M10,ROW(INDIRECT("1:"&MATCH("May",B1:M1,0)))+1,0))
I'm tracking hours for my company and I need to see the updated hours daily. I have everything formatted how I want it, except I want two columns to show how many hours over and under each employees current hours are.
What I have right now is
=(D3-C3)+(F3-E3)+(H3-G3)+(J3-I3)+(L3-K3)+(N3-M3)+(P3-O3)
But it is including all the empty cells (for days that haven't been worked yet) as a zero.
I want a formula that can allow me to ignore those blank cells until they have content.
I can't just use a SUMIF >0 function because I need to count the number of hours employees have MISSED (i.e. scheduled 12 hrs, actually worked 0).
Here's an alternate approach to #Tom's, though it works on similar principles. This one, however, relies on your ability to add a couple of 'HELPER' rows, above your current data.
I'm assuming that row 1 will alternate between saying "PROJECTED", and "ACTUAL".
I'm assuming that row 2 will be dates for that week, in Date format. So A2 will be Jan 1 2015, B2 will be Feb 1 2015, C3 will be Feb 1 2015, or however often the time blocks go up. The key here is that the PROJECTED columns and the ACTUAL columns will each need the date in them.
The formula to check the variance between that row's PROJECTED amount and that row's ACTUAL amount, only for dates prior to today, is (for row 3 and copied down, and assuming the data goes to column Z):
=SUMIFS(A3:Z3,$A$1:$Z$1,"PROJECTED",$A$2:$Z$2,"<"&TODAY())-SUMIFS(A3:Z3,$A$1:$Z$1,"ACTUAL",$A$2:$Z$2,"<"&TODAY())
This checks to see the value of PROJECTED columns for that row, where the date is less than today, and subtracts the value of ACTUAL columns for that row, where the date is less than today.
If you are looking to compare with something other than TODAY(), you can set up a cell to be your 'comparison point'. Manual type the breakoff period you are concerned with into that cell, and replace "&TODAY()" with, say, "&AA1" [assuming your breakoff point is entered in cell AA1].
As it stands, either a very long series of IF's and OR's or an array formula:-
=SUM(IF(OR(D3="",C3=""),0,D3-C3),IF(OR(F3="",E3=""),0,F3-E3),IF(OR(H3="",G3=""),0,H3-G3),IF(OR(J3="",I3=""),0,J3-I3),IF(OR(L3="",K3=""),0,L3-K3),IF(OR(N3="",M3=""),0,N3-M3),IF(OR(P3="",O3=""),0,P3-O3))
=SUM(D3:P3*ISEVEN(COLUMN(D3:P3))*(C3:O3<>""))-SUM(C3:O3*ISODD(COLUMN((C3:O3))*(D3:P3<>"")))
The second one must be entered with CtrlShiftEnter
Note that it could easily be broken by insertion/deletion of columns.