I am trying to write a formula in Excel that will compare 2015 totals to 2016 totals and projections. If there is a value in the rows for January, February, March and April, I want the 2015 sum of those same months. Then the same for the projected
Screen capture of excel file
I like to use SUMPRODUCT() for something like this:
Projected:
=SUMPRODUCT(($B$5:$B$16<>"")*$A$5:$A$16)
Actual:
=SUMPRODUCT(($B$5:$B$16<>"")*$D$5:$D$16)
Related
Let's say that I have a three column table/range for all of 2022: date, Day of Week, and Sales. I want to be able to calculate the average sales for a Monday, Tuesday, etc. Using Visual Basic, how would I pull sales for every Monday in 2022 into the Average() function?
As Scott mentioned, Averageif, or Averageifs to test multiple criteria.
Example of Averageif for only DoW:
=AVERAGEIF(B:B,E2,C:C)
Example of Averageifs for Dow and Year
=AVERAGEIFS(D:D,B:B,G2,C:C,F2)
Other options include pivot table
This is just a quick one:
Playing With Dates (Excel Formula)
If you have Microsoft 365, in cell F2 you could use:
=LET(MyArr,(TEXT($A$2:$A$33,"dddd")=$E2)*(YEAR($A$2:$A$33)=F$1)*$C$2:$C$33,
AVERAGE(FILTER(MyArr,MyArr<>0)))
or
=AVERAGE(FILTER($C$2:$C$33,
MAP(TEXT($A$2:$A$33,"dddd"),YEAR($A$2:$A$33),
LAMBDA(lDay,lYear,AND(lDay=$E2,lYear=F$1)))))
and copy to the right and down (F2:G8).
The days are in E2:E8 and the years e.g. 2021 and 2022, are in F1:G1.
These only use the Date and Sales columns.
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 am trying to get a formula that counts up how many cells contain this month and how many cell contain < than current month eg: in a column
March 2015
January 2016
April 2016
May 2016
May 2016
May 2016
June 2016
And then have a cell at the bottom that tells me 3 for May and 3 out of date
Assuming your data were in column A and you had 15 points, then the following two formulae should work.
Number of cells in the current month:
=COUNTIF(A1:A15, "5/1/2016")
Number of cells before the current month:
=COUNTIF(A1:A15,"<5/1/2016")
I have a time-series data collected as this :
Year Month Data
2015 1 0,92
2015 2 0,91
2015 3 0,90
and I want to plot it to have month strings like February 2015 in the x-axis.
Can I do this with an extra column with a formula before Data, or how can I do this?
Use the following as a formula (assuming year is in cell A1 and month is in cell B1)
=TEXT(DATE(A4,B4,1),"mmmm-yyyy")
Considering the language issue:
=CHOOSE(B3;"January";"February";"March";"April";"May";"June";"July";"August";"September";"October";"November";"December")&" "&A3
However, these are strings and an axis based on them will not be a time scale.
I have a cell that includes a drop down list of months for a user to select from.
What I would like to do is use whatever month is selected in the drop down to drive sums in the workbook.
For example, in one sheet I have the the drop down list of months in C4.
In another sheet I have dates and corresponding data (starting in A1 and A2):
July August September October etc... YTD Total
50 100 75 60 etc... ?
So what I'm looking to achieve here is to sum the monthly figures up to the date selected in the drop down menu by the user, i.e. if September is selected in the drop down - then the YTD total will include July, August, September (NB - financial year starts in July, not Jan).
Thanks in advance people.
Using INDIRECT you can create the range reference for the SUM from a string.
Something like this:
=SUM(INDIRECT("R2C1:R2C"&MATCH(C4,A1:E1,0),FALSE))