Excel formula for entering bi-weekly dates - excel

I have the following worksheet:
The grid is filled with the following formula (this example is from cell H4) that populates the grid based on inputs from the table on the left, =IF($A4="","",IF(AND($E4="Daily",H$2>=$D4,H$2<=$G4),IF(RIGHT($F4,2)="30",LEFT($F4,LEN($F4)-2)&"/",IF(RIGHT($F4,2)="00",LEFT($F4,LEN($F4)-2),$F4)),IF(AND($E4="Weekly",H$2>=$D4,H$2<=$G4,TEXT(H$2,"DDD")=TEXT($D4,"DDD")),IF(RIGHT($F4,2)="30",LEFT($F4,LEN($F4)-2)&"/",IF(RIGHT($F4,2)="00",LEFT($F4,LEN($F4)-2),$F4)),IF(AND($E4="Bi-Weekly",H$2>=$D4,H$2<=$G4,MOD($D4+14,H$2)=0),IF(RIGHT($F4,2)="30",LEFT($F4,LEN($F4)-2)&"/",IF(RIGHT($F4,2)="00",LEFT($F4,LEN($F4)-2),$F4)),IF(AND($E4="Monthly",H$2>=$D4,H$2<=$G4,TEXT(H$2,"MM/DD/YYYY")=CONCATENATE(TEXT(H$2,"MM"),"/",TEXT($D4,"DD"),"/",TEXT($D4,"YYYY"))),IF(RIGHT($F4,2)="30",LEFT($F4,LEN($F4)-2)&"/",IF(RIGHT($F4,2)="00",LEFT($F4,LEN($F4)-2),$F4)),IF(COUNTIF('PowerPoint Gantt'!$A$5:$A$12,$A4)=1,IF(H$2=VLOOKUP($A4,'PowerPoint Gantt'!$A$5:$E$12,5,FALSE)+31,"R",""),""))))))
The only part of the function that isn't working is the Bi-Weekly selection. I can't figure out how to get recurring entries. I can get the start date and one 14 day period after. I've tried using the CEILING function also but still only gets me the next 14th day marked, instead of every 14th day. And ideas?

In your rule for Bi-Weekly meetings, it seems that
MOD($D4+14,H$2)=0
should be replaced with
MOD(H$2-$D4,14)=0
The latter takes the difference between the starting date and the actual date and checks to see if that can be divided by 14, the number of days in 2 weeks.
Your rule for Weekly meetings could be approached similarly, which seems simpler to me than a rule based on the name of the day, like you are using now.

Related

Is a date within several date ranges

I'm trying to put together an excel spreadsheet to show the day-by-day impact of stays by 3rd country citizens in the EU's Schengen area (it's a fairly complex rolling 180 day window). At the moment, I have a column with every day from a start date (so lots of rows) and another where I enter a 1 if there was a stay in a Schengen country for that day. Then other columns calculate when the 180 day period started and how many days have been in Schengen for that day.
It's a bit of a faff having to enter a 1 for every day away. I'd like to have another worksheet where I simply enter the start and end dates of (an arbitrary number of) each stay and then the calculation spreadsheet simply works out if each date falls within a stay or not. Working out whether a date falls within one date range is pretty straightforward, but working out if it falls within several date ranges isn't obvious to me. Any suggestions please?
After a very fair comment, here's a couple of images that hopefully illustrate what I'm trying to do (please ignore the colours).
Example of date ranges, but the number of these should be arbitrary:
The calculated sheet - currently I have to enter the 1s individually whereas I'd like them evaluated from the date ranges:

How to forecast values based on 3/5/7/10 etc. last observations (Excel)?

I have two columns of observations: Date and Number of Registrations.
Date
Registrations
01-05-2020
7841772
02-05-2020
8101873
03-05-2020
8065389
04-05-2020
7127299
...
...
19-05-2020
7208950
20-05-2020
7117984
21-05-2020
7906914
22-05-2020
to forecast
23-05-2020
to forecast
24-05-2020
to forecast
...
...
My task is to forecast the number of registrations for the remaining days based on 3/5/7/10 last values. So the first time I have to pick values from May 19th till May 21st, the second time - from May 17th till May 21st and so on.
The problem is, that there is a cell with a fixed number of days I have to use. There is a dropdown list that should affect the forecast every time I change the value in it.
I've been struggling the whole day to adjust my forecast.linear() function so it takes into account these changes.
Would appreciate any help.
If I have understood the question, you could use an OFFSET. It is a volatile function, so you would not want to use this if you have to implement it on many sheets and if there is a lot of data entry as it will make the worksheet slow.
If you put the dropdown in D1, and your dates are in A and values in B, then the formula in the forecast area would be:
=FORECAST.LINEAR(A23,OFFSET($B$22,0,0,-$D$1,1),OFFSET($A$22,0,0,-$D$1,1))
Where row 22 is the 21st of May as shown in your table above.

Excel - Bi-Weekly Tasks - Fill Calendar

I have a Task month calendar. when i change the month of the calendar it shows me what I have to do which day of the month.
I basically have a list of task, when i change the month the tasks date automatically change accordingly a series of rules and that list will populate the calendar.
Calendar
Tasks
But I have some tasks that are bi-weekly, and I dont have a specific week to be done, they have to be done in the fortnight after the last time.
so I have the first week (day) that the task was done and i have the first day of the month i am... and with that i would wanted to know which days of the month i have to do that specific task.
Can you help me?
use the last reference point as the basis for creating the next due date. this would be the date the task was last performed. If it is due a fortnight from that last date then add 14 days. You may want to record the date that task was performed each time so that your formula is based on the date it was last completed each time it is calculated.
If you are wanting to plan ahead then make an assumption that it will be done in consistent 14 day iterations then build your formula to consider the actual date it was completed to readjust the plan going forward. So it will assume this will be done consistently until advised otherwise with an actual date it was last completed.
The trick is to get the first date in the month that matches the weekday of the last date and then you can easily add 14 days. Much like finding the first Monday/Sunday in a month to build a calendar.
A1 contains the last time the task was performed
C1 contains the 1st of the month
C1+7-WEEKDAY(C1+7-weekday(A1))
will return the next weekday that matches the weekday the task was last performed.
=C1+7-WEEKDAY(C1+7-weekday(A1))-A1
returns the number of days since
=(C1+7-WEEKDAY(C1+7-weekday(A1))-A1)/2
returns the number of days divided by 2. If this result is not a whole number (#.5) then it's not in the bi-weekly cycle and we need to add another 7 days to get the correct start date. If it is a whole number then it is our start date. We can use the mod function to find out if there is a decimal value.
=if(mod((C1+7-WEEKDAY(C1+7-weekday(A1))-A1)/2,1)>0,C1+7-WEEKDAY(C1+7-weekday(A1))+7,C1+7-WEEKDAY(C1+7-weekday(A1)))
Below or next to this cell you can simply reference the cell and add 14 =D1+14 and then add as many as you want to display.

Time series mock data generation for 16 years of quarterly data in Excel or Matlab

I would like to generate a mock time series quarterly dataset from, say, 2000-2016 for a variable (quarterly credit growth) that averages around a certain value (say, 30%). Can anyone give a suggestion on how to do this in principle?
Edit: what I was implying were the actual data values for each time period, i.e. data with a certain mean and variance.
Found a solution with a code in Matlab, for anyone interested, see below in answers.
Excel approach:
You can make column A your date list. In A1, or A2 or more if you have header rows, you will have to seed your list by providing the first start date. Lets assume you put your seed date in A2. I would then go about adding 3 month to you start date using a formula, and copy down until you have hit your desired date. In order to add the 3 months I would use the following in A3.
=date(year(A2),Month(A2)+3,day(A1)
that will give you the first day of the month every 3 months. If you want the first day of the month every 3 months, set the day to 1 like so:
=date(year(A2),Month(A2)+3,day(A1)
And end of month could be calculated as:
=eomonth(date(year(A2),Month(A2)+3,day(A1)),0)
however I would prefer to do the end of month calculation based on the row you are in so I would do it more like:
=EOMONTH($A$2,(rows($A$2:A3)-1)*3)

COUNTIF only if header of column contains specific text

I am trying to write a function in excel (without using vba/macros if possible), to count the number of remaining work days for each employee for the month, from the first of the month to a date I enter into A1. The problem is, the scheduling file I use starts on a Monday every time, so if the month begins on a Friday, there are 4 days from the previous month on the page and the same could happen at the end of the month if the month doesn't end exactly on a Saturday.
In row 6, I have the dates (formatted as 28-Sep-2015), and from rows 9 and below, I have employee names and whether or not they're scheduled to work on the days directly above in row 6. I'm looking to count the number of times the word "WORKING" appears in the row for each given employee, but only to count it if the header in row 6 contains "Sep". I don't want to count any times "WORKING" appears if it comes from the past month or the upcoming month. (Also, no one works Sundays, so Sundays are skipped.)
I'll try to show an example of set up here.. hopefully it can help:
A1: 28-Sep-2015
A6-H6: Employee, 28-Sep-2015, 29-Sep-2015,30-Sep-2015, 1-Oct-2016, 2-Oct-2016, 3-Oct-2016
A9-H9: George, WORKING, OFF, WORKING, WORKING, WORKING, WORKING
So for this small example, the result should only be 2 working days, since George only works twice from 28 Sep to the end of the month.
I've been searching for how to do this for a few days now, but nothing seems to work when I try it. Please help!
If you are using 2007 and later than use this:
=COUNTIFS($A$6:$G$6,"<="&EOMONTH($A$1,0),$A$6:$G$6,">="&DATE(YEAR($A$1),MONTH($A$1),1),$A9:$G9,"=WORKING")

Resources