Excel - Sum values based on date - excel

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))

Related

Showing percent difference in values in excel

I have a table and in Column 1 is a list of companies, and company names may appear more than once because Column 2 is a year. Column 3 is the amount a company spent in that respective year. How can I show the percent differences between each year without spilling into the next company? For instance Company, A is 2017-2020 and i want to show the % growth for that. But the next row is Company B for 2017-2020 and I don't want to calculate the % between the values for 2020 Company A and 2017 Company B.
To calculate the % between the values for different companies:
Sort the data by company.
Find the percentage of the amount. Select the cell. Click Home > Number Format > Percentage. Enter the formula in cell C2: =B2/A2.
Find the percentage of change between two amounts. Select the cell. Click Home > Number Format > Percentage. In cell B3, divide the company A's second year’s sales by the first year, and then subtract 1, or enter the formula in cell C3. =(B2/A2)-1.
Read more about calculating percentages at support.microsoft.com.
Hope it helps, Please upvote!
You can use a Pivot Table for this:
As you can see, Company A invested 1000 on 2017 and 2000 on 2018. So 2000-1000=1000 and '1000 / 2017 investment (which is 1000)= 100%'
Company A invested 3000 on 2019 and 2000 on 2018. So 3000-2000=1000 and '1000 / 2018 investment (which is 2000)= 50%'
And so on.
About Pivot Tables, check:
Create a PivotTable to analyze worksheet data
My setup in Pivot Table is:
Field Company into rows section
Field Year into Columns Section
Field 'Amount' into Values section
IMPORTANT: Field Amount must change setup. Change option show values as and choose % difference with previous year

Active Employees by Month

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

Dynamic SumIFs - Multiple Scenarios

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

Excel: Reference row indicated by cell

I have a sheet where each row is a month and columns are monthly numbers.
I made a separate sheet for each month where the numbers from each month can be pulled together and added up.
To do this, I've made a template for January and used references like: ='2019'!A8
I went through each month and changed the row number being referenced. ( ='2019'!A8 would change to ='2019'!A9 for the next month.)
Is it possible to pull the number for the reference from a different cell?
Could I have somehow referenced a cell which was just the number and used it for ='2019'!A#` Rather than change all my references by hand?
With a month indicator in each monthly sheet (say in D1 and 03 for March) then with all the monthly sheets grouped together my present understanding of what it is you want should be achieved with:
=INDIRECT("2019!A"&$D1+7)
(Don't forget to ungroup.)
I suppose your data look like:
Month Sales
January 500
February 1000
March 1500
... ...
Moreover somewhere on your monthly sheets I suppose the month will be written in a cell, say A1.
Then you could simply use the same VLOOKUP on all these sheets:
=VLOOKUP(A1;SALES_DATA;2;FALSE)
And if your monthly sheets name contain the month name in some way, you could even do something like:
=VLOOKUP(MID(CELL("filename";A1);FIND("]";CELL("filename";A1))+1;255);SALES_DATA;2;FALSE)
CELL("filename";A1) retrieves the whole sheet path like C:\Users\...\Desktop\[Sales.xlsm]March".

How to get a bill to populate with the amount, only if the particular payday falls exactly on or 6 days before the due date?

=IF(AND(DATE(YEAR(EE$2),MONTH(EE$2)+IF($B6<DAY(EE$2),1,0),DAY($B6))>=EE$2,DATE(YEAR(EE$2),MONTH(EE$2)+IF($B6<DAY(EE$2),1,0),DAY($B6))<EE$2+14),470,”")
Using Google Sheets to make a budget (See attached image snapshots). I’m a little bit stuck on a complex spreadsheet formula (listed above). What I’m trying to do is get a bill to populate with the amount, only if the particular payday falls exactly on or 6 days before the due date. Here’s what I’m working with:
Column Headers: I have set these cells so that they auto-populate with the payday, which happens every week on Friday.
Row 6 and 7 are where I want the amount to show up. I’ve been having to put them in manually, but I’d like to automate it for the length of the bill (60 months)
Column B, cells (B6 & B7) are set with a plain text number corresponding to the day of the month it’s due (i.e. 5th of each month for the Ford). So B6 cell has number 5 in it.
If the due date for the Ford Car Payment is the 5th of every month, I need the number $470 to populate into the cell if the date above the column is the 5th of the month or minus 6 days from it. Because the bill doesn’t always fall on a payday, as in the in EE or EF Column, it needs to populate with $470 on the EE6 cell to make sure the bill is paid on time.
Essentially, I want to be able to paste the formula into the 6th row, and have it only populate on the pay date closest 5th of each month, but not after the 5th. If it returns 0 like on cell ED6, the cell should remain blank.
Any ideas how I can make this possible?
=IF(ISNUMBER(MATCH($B5, ArrayFormula(DAY(C$3+{0,1,2,3,4,5,6})), 0)), 470, "")
Using C3 as the start assuming your calendar days start at C3.
The way this works is:
ArrayFormula(C$3+{1,2,3,4,5,6}) Generates a synthetic Range of dates starting at the date in C3 and the week following
ArrayFormula(DAY(C$3+{1,2,3,4,5,6})) just extracts the day's number of the month from all the dates. A date range from 2017-01-28 - 2017-02-03 would leave you with {28, 29, 30, 31, 01, 02, 03}
MATCH($B5, <2>, 0) Will try to find the Due month-day in the month-day list we just generated and return the position or an error if it is not there.
ISNUMBER(<3>) will be TRUE if the day is contained, otherwise false
IF(<4>, 470, "") Prints the payment on the correct dates, of course you can change 470 to a cell reference like $ZZ5.
You can drag this formula right and down

Resources