Excel Formula to generate month Date of project - excel

I'm working with a sales pipeline sheet and need a formula to generate the project start and end months based on invoice charges inputted in month columns. For example if a client delays a project and invoice months change, I'd ideally like the Project start and end month to update automatically as I update invoice months.
For example if I was to move 2000 and 1000 on the table below (row 1) to the Apr & May columns respectively, the formula would update Project start to Apr, and Project end to May.
Project start
Project end
Jan
Feb
Mar
Apr
May
Jan
Feb
2000
1000
Jan
April
1000
1000
1000
1000
[forumula to generate feb?]
[forumla to generate May?]
500
500
500
500
500

I would advise you to use the following cell formatting for the dates of your project (cell formatting, Custom):
mmm
In order to get to the next month, you can use the following formula:
=MONTH(DATEVALUE(DAY(B8)&"/"&MONTH(B8)+1&"/"&YEAR(B8)))
This takes the day, the month plus one and the year, and converts this into a new date from which the cell formatting will just show you the month. Be careful: this only works while working within the same year. In case you jump from December to January the next year, you need an IF() function to make this work.

You can use these formulas for the start and end date - if you have Excel 365
=INDEX($A$1:$G$1, MIN(FILTER(COLUMN(D2:G2),D2:G2<>"")))
=INDEX($A$1:$G$1, MAX(FILTER(COLUMN(D2:G2),D2:G2<>"")))
COLUMN(D2:G2) returns an array with the column indices of the invoice amounts.
FILTER only returns those column indices that have an amount
and finally MIN and MAX return the first and last column index
this is then passed to INDEX on the header row.

Related

Excel count if date range is active in a certain month

I have 2 date, a start date and end date. I want to be able to count if these were active through a certain month.
Row 1: start date 20/11/2020, end date 03/02/2021.
Row 2: start date 03/01/2021, end date 15/03/2021
Row 2: start date 12/01/2021, end date 31/03/2021,
The columns I have are the months and based on the above data this is the expected result.
Nov 1
Dec 1
Jan 3
Feb 3
Mar 2
Is there a formula that I can use to count this through a range of 100's of rows?
A simpler method than what you posted in your comment.
Put your start/end dates in a Table and name it StartEndTbl
Create a column of months whereby
Each entry is the first day of the month
The column is formatted mmm-yyy
In the first cell (F2 in this case), enter the formula:
F2: =SUM((StartEndTbl[Start]<=EOMONTH(E2,0))*(StartEndTbl[End]>=E2))
and fill down as far as needed

Find first date after today that matches a day-number and weekday

Given any date, how do I find the first month and year in the future where the 31st of that month falls on a Wednesday, in other words, for today, 11 November 2020, I would like to see (31) March 2021. [Updated: Returned month should be March 2021]
#prino,
You could make use of Excel's Iterative Calculation, setting Maximum Iterations to 1000.
In the example below, A1 is the given date and B1 receives the result (put the formula in B1):
=IF(B1=0,A1)+B1+IF(AND(WEEKDAY(B1,1)=4,DAY(B1)=31),0,1)
If you have Excel 365 then
=LET(DayInMonth, DATE(YEAR($A$2),MONTH($A$2)+SEQUENCE(336,,0,1),$B$2),
DOW, WEEKDAY(DayInMonth),
IsMatch, (DAY(DayInMonth)=$B$2)*(DOW=$C$2)*(DayInMonth>=$A$2),
XLOOKUP(1,IsMatch,DayInMonth,,0,1))
How it works:
Parameters are on the sheet (you could hard code these into the formula if you wish)
A2 is the start date (could be formula =TODAY())
B2 is the day number in the month
C2 is the day of week code (1..7 = Sunday..Saturday)
The calander repeats every 28 years. So only need to consider 12*28 = 336 months
DayInMonth is the specified date in each of the next 336 months, including this month. Note: if a month does not have the specified day (eg 31 September does'nt exist)
DOW is the day of Week code for those dates
IsMatch is 1 if calculated DayInMonth matches specified DayInMonth (this excluded non-existant dates) AND Calculated DOW matches specified DOW AND calculated date is on or after start date
XLOOKUP returns the date of the first 1 in the IsMatch array

Return last day per month (and week) in dataset

I have a large amount of daily stock market closing data that I need to report on, however I only need the last day of the month from each data set.
Given the dates of each month will differ year to year depending on weekends and public holidays I can't just use =EOMONTH(A2,0)
How do I extract, just the last day of each month from a data set probably using the MAX functionality in some way. Then I can just do a Vlookup to get the data for that date,
[![Share Price Sheet][1]][1]
If your date column is sorted by small to large, index() and match() could solve this problem.
Try to use:
=INDEX(A:A,MATCH(EOMONTH(DATE(D2,E2,1),0),A:A,1))
which point is set third argument to 1 in MATCH function.
If you want to get close price, in G2 cell write:
=VLOOKUP(F2,A:B,2,FALSE)
Since the last date is found on the dataset you have, you can just select distinct your year & month in a new sheet, create a helper column combining the 2 columns.
Create the same helper column in your original dataset, sort dates by newest to oldest. And you can vlookup the exact date. If you just want the day part of the date, extract the date from the Date itself with the day formula
You can do this just by Pivot Table
Select your data (I used a snipped only)
Insert a Pivot Table
Use Year, Date and Close as your Row labels
Use Date also as a value field
Set Date in your value field to show Max, format to actually show dates and rename if you want, e.g. "Last Day"
Click any date under any month in the row labels > Filter > Top-Ten > Choose to filter top 1 under Last Day and confirm.
Format your pivot table to your liking, maybe hiding subtotals.
My end result looks like:
You could use a combination of EOMONTH and WORKDAY.
For example:
The date you're looking at is 21st November 2019.
=EOMONTH(DATEVALUE("21 Nov 2019"),0)+1 will return 1st December 2019.
30th November is a Saturday, and for some reason the 25th to 29th November are holidays.
=WORKDAY(EOMONTH(DATEVALUE("21 Nov 2019"),0)+1,-1,{43798,43797,43796,43795,43794}) will return 22nd November as last working day of the month.
Using cell references (D3 = Date, A1:A5 are the holidays):
=WORKDAY(EOMONTH(D3,0)+1,-1,$A$1:$A$5)

Calculating Based on an Array in Excel

I have a Pivot Table that I am able to cycle through the different months based on a Month Filter (changing the data of the table). I am trying to calculate based off of that change of value. I am recording the amount of times a license is used in a workday. The number of workdays in a month change based on the month. I calculated out the workdays for each month using
=NETWORKDAYS(H34,EOMONTH(H34,0),J34:J45)
H34 references my 1/1/2016 date. J34:J45 references my holiday dates to avoid.
I am trying to write a formula that says "If the month listed (from my month filter) within the Months list then to print the corresponding Workdays value.
=IF(G34:G46=H48, I34:I46)
It only works on January. The rest of the values return False. I do calculate it as an Array Function. It returns either False. I cannot think of another function that could replace it. Any help would be appreciated.
2016
Month Date Workdays Holiday Dates Holidays
January 1/1/2016 19 1/1/2016 New Year's day
February 2/1/2016 20 18-Jan Holiday 2
March 3/1/2016 22 2/15/2016 Valentines day
April 4/1/2016 21 3/25/2016 St. Patrick's Day
May 5/1/2016 21 5/30/2016 Memorial Day
June 6/1/2016 22 7/4/2016 Independence Day
July 7/1/2016 21 9/5/2016 Labor Day
August 8/1/2016 23 10/10/2016 Holiday
September 9/1/2016 22 11/8/2016 Columbus Day
October 10/1/2016 21 11/11/2016 Veteran's Day
November 11/1/2016 21 11/24/2016 Thanksgiving
December 12/1/2016 21 12/26/2016 Christmas
All 235
Selected Month
March FALSE
The VLOOKUP() function will greatly simplify this process for you. This particular function is great for extracting values in a list based on a key lookup field.
In your example, you want to easily extract the value from Holiday Dates column based on an input month.
A few things to keep in mind for the input parameter functions in this function:
The first column in your table array must contain the lookup value, in this case, the month column.
If may need to lock your array dimensions, use the $ sign in front of the column letter and row number.
FALSE should be selected for the range_lookup in order to do exact matching for the lookup value. If you choose false, you may get false positivies.
Every row in your list should be unique for the lookup value. Let's say January was listed twice, the value returned would be for the first occurrence.
Additional info:
http://spreadsheeto.com/vlookup/
http://www.howtogeek.com/howto/13780/using-vlookup-in-excel/
You can use the LOOKUP function, as follow:
=VLOOKUP(G48,G34:I45,3)
This formula looks up "G48" value in column G (first matrix column), and returns the value from column I (third matrix column) that is in the same row.
Read this official Office page for more details.
Please, give us your feedback.

Is it possible to reference Cells via Cells in Microsoft Excel

In a spreadsheet i'm trying to fix up, on the final page i want it to gather totals, so far this is the structure
Month | Year | Month Start | Month End | Month Total
how this supposed to work is that the user enters the month and year then inputs the start and end rows (Month Start and End) of another page, this other page will contain records of transactions made with each transaction being a separate row, this can mean one month can have 5 transaction while another may have 50
i'm making the assumption that the user doesn't now how to reference data from another sheet so how i want to try and implement it so that they add the row numbers to Month Start and End and Month Total will generate the formula
eg.
Month Start = 4
Month End = 6
Formula Generated in Month Total = "=SUM(Transactions!E4:E6)"
if the user changes Month End to 9, the formula generated above will change the E6 part to E9, like i said above, each row in the Transactions sheet is a transaction and there can be variable number of transactions a month
what i am asking is if it is possible to references cells like this
Take a look at the INDIRECT function
You can use the OFFSET function to generate offsets from a starting point.
Assuming your layout is like this:
A B C D E
1 Year Month Start End Total
2 2012 Jan 4 9 =sum(...)
The total column (cell E2) could have the formula:
=SUM(OFFSET(Transactions!E1,C2-1,0,(D2-C2)+1))

Resources