Subract a series of business days from a Date - excel

I have a given START DATE and series of milstones that happen on all business days. I need to calculate the given DATE based on subtraction of NETWORKDAYS (Business days + Holidays) from the date. Here is the data:
Start Date: (A1) 6/30/2014
Business Days to subtract:
B1-B3:
3
5
7
In a perfect world, I want to type in this function: =subtractnetworkdays (6/30/2014-B1) with the result being (6/27/2014) or if a weekend (6/25/2014).

=IF(A1,WORKDAY(A1, $B$1 * -1),"")
Note that the $B$1 is required so when you copy the formula to other cells, the same amount of business days gets subtracted. The IF statement has been added to not show #VALUE! inside the blank cells. The cell will remain blank until a date is entered.

Related

Excel Date Formula + 3 Months

I am looking to have a formula that takes the date that is manually input in a cell (E2) and automatically populates a date in the column next to it (F2) that is + 3 months from the date manually input in (E2).
eg. If (E2) has 03/11/2021 input manually then the formula in (F2) would populate 03/02/2021. image of part of the sheet
Is this what you are looking for?
=DATE(YEAR(A1),MONTH(A1)+X,DAY(A1))
where X = 3
One can use EDATE():
=EDATE(A1,3)
The second criteria is the number of Months to add.
EDATE will go to the number of months then try to equate the day. If the day exceeds the number of days in the target month it returns the last day of the target month.
For example =EDATE(DATE(2021,11,30),3) will return the 28th of February 2021.

EXCEL - How to spread X amount over N number of months

I am creating a revenue recognition model that tells the user the specific months X amount of revenue falls into based on specific start date. For example, I have an invoice dated 1/1/17 for $1200 total in monthly services that will be incurred over the next 3 months ($400 per month)
I want to create the model so the user enters the invoice date "1/1/17", the invoice amount "1200", and the number of months the invoice amount is spread over. In this case "3".
The model is setup with 24 columns which have the MM/YYYY header in each column. "Jan 2017, Feb 2017..Dec 2018". As the user enters the date, amount and # months, the values per month "400" will populate in Jan, Feb, and March 2017. The remaining months will have zero or be blank because no revenue will be allocated in those months.
I don't want anyone to give me the answer here, but I don't even know if this is possible in excel without using VBA. Some insight in how to get started would be helpful. Thanks!
This could be a start:
B1, B2 and B3 are the input cells. B1 must be a date not a string.
D1 to O1 are the months. The values must be dates, not strings, but could then be formatted to show only month and year. Format MMM YYYY for example.
You need only inputting D1 and E1 as dates 2017-01-01 and 2017-02-01, then select D1:E1 and fill to right. Then a series will be created having from step to step the difference of E1 - D1, which is 1 month in this example.
Formula in D2 is
=IF(AND(D$1>=DATE(YEAR($B$1),MONTH($B$1),1),D$1<=DATE(YEAR($B$1),MONTH($B$1)+$B$3-1,1)),$B$2/$B$3,"XX")
and can be filled to right as needed. In the example up to O2.
Now if you are changing any of the input cells, the values in D2 to O2 will also changing due to the formula.

Excel - how to get if a date is a specific day of the week?

I have a spreadsheet that tracks average file processing times over the course of a month. One of the macros and stats that we like to pull, is performance on Mondays (as the files are a little built up over the weekend). The spreadsheet is organized into columns by weekdays of the month:
The dates are formatted MM/DD/YYYY, so I would think Excel has a date function that it can determine weekday based on that date value.
Currently, I just have to manually tell the Macro which columns are Mondays, like so:
=AVERAGE(B20,G20,L20,Q20)
So, instead of manually, how would I get the average over the range of say, B20 to V20, only if the day of the week is Monday (the date cells are in row 1, so B1 to V1)?
To determine the weekday of a date in EXCEL use the =WEEKDAY() formula, which evaluates as 1 (Sunday) to 7 (Saturday)
e.g. If A1 contains 12/31/2016 (or 31/12/2016 if you're from where I'm from), the formual =WEEKDAY(A1) would evaluate to 7 (indicating that the last day of 2016 was a Saturday)
To apply this formula to your problem: (assuming that the dates are in row 1 and the values are in row 2)
insert a new row to hold the WEEKDAY() value (say, row 2)
in cell A2 type in =WEEKDAY(A1)
copy this formula as far right as necessary (to include all your dates)
Your average for Mondays is calculated as =AVERAGEIF(2:2, 2, 3:3)
Possibly, you can add a column called [Day Of The Week] and use the following formula to display the day.
TEXT(B4,"dddd")
Then add an 'If'statement to your result cell.
simply
=SUMPRODUCT((MOD(B1:V1,7)=2)*B20:V20)/SUMPRODUCT((MOD(B1:V1,7)=2)*1)
should give the average of all values from B20 to V20 if the corresponding cell in row 1 is a monday.
the first part sums the values of all mondays and the second part counts them (sum / count = average) ;)
If you have any questions, just ask.
If your date is in A1, you can use =Text(A1,"dddd") to determine the day of the week (it will return the name, "Monday", "Tuesday", etc.) so then you could do perhaps:
=If(text(A1,"dddd")="Monday",[do whatever],[do whatever]) (may need a helper row/column to hold the text of the weekday)
(Or use AverageIf() and use the Text() idea.)

Find last digits with IF

I have lots of cells in the spreadsheet that contains the whole year, date and stock prices, but I only need the dates from 25th of the last month till the 5th of this month.How can I write a function to do that? For example if the cells are like this in the column:
19900101
19900102
19900103
19900104
19900105
.
.
19900125
19900126
19900127
19900128
19900129
19900130
19900131
I want it to show only days (1,2,3,4,5,25,26,27,28,29,30,31) with the date format.
The date shows in the text format and I've tried format cell to change it but it doesn't work.
For a slightly different approach, assuming you want to return the A2 value only if it represents a date in the last 5 or first 5 days of any month you can use this formula in B2
=IF(DAY(TEXT(A2,"0000-00-00")+5)<11,A2,"")
TEXT function converts your data to a real date then if you add 5 days to that date then any date that was originally in the last 5 or first 5 of the month will now be in the first 10 days of the month.....so it's sufficient to check that the day is < 11. That will pick up 27th to 31st of a 31 day month, 26th to 30th of a 30 day month etc.
you could use a formula and then filter by rows with data...
As an example (given it's difficult to discern if you always want the first 5 and last 5 of a month or what....)
=IF(RIGHT(A2,2)*1<=2,A2,IF(RIGHT(A2,2)*1>=29,A2,""))
Based on all the edits and comments, these should be the function you need.
=IF(OR(A7-A2>5,MOD(A2,100)<=5),DATE(LEFT(A2,4),MID(A2,5,2),RIGHT(A2,2)),"")
You should place it in cell B2 and then do all the desired filtering, as explained in xQbert's answer.

Determining days between two dates in Excel if a specific criteria is met

Trying to count the number of days in a set period, if a certain criteria is met, where:
J4 is a departure,
F1 is the start of the period;
G1 the end date.
If a criteria is R in K4 it needs to give a total, minus one day, if something else it needs to give a blank result in L4.
If the date in J4 is after the end of the month, I need only the days within that month.
So for example: Reporting 1st to 30th June.
J4's date is 4th of June, their K4 value is R, that should report 3 days in L4.
j5's date is 2nd July, their K4 value is R, that should report 30 days.
=IF(EXACT(K4,"R"),IF(J4<G1,J4-F1,G1-F1+1),"") should work
The IF() command takes 3 values.
The first is the conditional statement you're evaluating The second
Next is the value a cell should be if that conditional statement is true
The third value is what the value should be if it's false.`
The EXACT() command takes 2 values, and compares them. If the values are the same it is True, otherwise it's False
Please try this:
=IF(K4="R",IF(J4>EOMONTH(G1,0),DAY(G1),DAY(J4)-1),"")

Resources