Google Sheet - calculating attendance from moving date range - date

Good day folks, we have a Google Sheet with training attendance. We are meeting on weekly basis and calculate attendance from the past four months, last 36 month and historical total.
Situation: Currently, we calculate the attendance by assigning 2 (double training)/1 (normal training)/0 (canceled training) to the value of the training and attendee (2 on double, 1 on normal, 0 when absent) - and get attendance percentage by comparing the person's points sum to that of the trainings during the given period (4 months, 36 months, total).
Issue: The problem is that every time we add a training (new row in the tab), we need to manually change date range in the 4 month calculation and end date in the 36 months. I would love to automate this process that every time we add a new column, we would not have to change the date range.
Cells:
C4 = maximum points available per trainings in the last 18 months
D4 = maximum points available per trainings in the last 4 months
C5 and below = user's attendance in the past 18 months (his points generated in that timespawn/total available points*100)
D5 and below = user's attendance in the past 4 months (his points generated in that timespawn/total available points*100)
E3:3 = cells with dates when we have trainings
E4:4 = points awarded per that specific training
E5:5 and below = points gained by the member per attendance
Question: is there any way count a number of training points gained in the past 4/18 months by a specific person?
Thank you kindly

try:
=SUM(FILTER(E5:5; E$3:$3>=TODAY()-120; E$3:$3<=TODAY()))/D$4

Related

Training year transition

enter image description hereI am hoping that someone can help me with the below problem.
I am trying to create a field in a database to indicate the date that a trainee will move to thier next year of training. They go to next year of training after 52 weeks training. They may have multiple placements during a particular training year.
I have their training start date (trainee::startdate... their start and end date (traineeplacement::startdate and traineeplacement::enddate) of each job (in a linked table), their percentage of full time (traineeplacement::PercentageFullTime) and the calculated number of weeks whole time equilavent in the job (traineeplacement::durationweeks).
Through using the cumulative time in a training (traineeplacement::training-duration), in excel I can find the end of the block before using Max statment with an imbedded if statement to find max value less than 52 weeks in cumulative time in training. I cannot seem to do this in filemaker. I would then like to find the next line in the traineeplacement table and from that I can calculate the end of training year date from start of placment date, % of fulltime, and number of weeks neediing to be worked to get to 52 weeks...
The placements are measured in weeks for ease and training runs over a minimum of 4 years, calculated from start and end dates of each placement. The placement dates are a consecutive, but I will only count the product of weeks worked and % of full time (full time =100%, not working (e.g. maternity leave) = 0%). Hope this makes sense and I have included a screen shot of the draft of the database to give you an idea of what I mean.
I hope this makes sense.
enter image description here
Excel spreadsheet
Excel Spreadsheet Formulae

Matlab average number of customers during a single day

I'm having problems creating a graph of the average number of people inside a 24h shopping complex. I have two columns of data on a spreadsheet of the times a customer comes in (intime) and when he leaves (outtime). The data spans a couple of years and is in datetime format (dd-mm-yyyy hh:mm:ss).
I want to make a graph of the data with time of day as x-axis, and average number of people as y-axis. So the graph would display the average number of people inside during the day.
Problems arise because the place is open 24h and the timespan of data is years. Also customer intime & outtime might be on different days.
Example:
intime 2.1.2017 21:50
outtime 3.1.2017 8:31
Any idea how to display the data easily using Matlab?
Been on this for multiple hours without any progress...
Seems like you need to decide what defines a customer being in the shop during the day, is 1 min enough? is there a minimum time length under which you don't want to count it as a visit?
In the former case you shouldn't be concerned with the hours at all, and just count it as 1 entry if the entry and exit are in the same day or as 2 different entries if not.
It's been a couple of years since I coded actively in matlab and I don't have a handy IDE but if you add the code you got so far, I can fix it for you.
I think you need to start by just plotting the raw count of people in the complex at the given times. Once that is visualized it may help you determine how you want to define "average people per day" and how to go about calculating it. Does that mean average at a given time or total "ins" per day? Ex. 100 people enter the complex in a day ... but on average there are only 5 in the complex at a given time. Which stat is more important? Maybe you want both.
Here is an example of how to get the raw plot of # of people at any given time. I simulated your in & out time with random numbers.
inTime = cumsum(rand(100,1)); %They show up randomly
outTime = inTime + rand(100,1) + 0.25; % Stay for 0.25 to 1.25 hrs
inCount = ones(size(inTime)); %Add one for each entry
outCount = ones(size(outTime))*-1; %Subtract one for each exit.
allTime = [inTime; outTime]; %Stick them together.
allCount = [inCount; outCount];
[allTime, idx] = sort(allTime);%Sort the timestamps
allCount = allCount(idx); %Sort counts by the timestamps
allCount = cumsum(allCount); %total at any given time.
plot(allTime,allCount);%total at any given time.
Note that the x-values are not uniformly spaced.
IF you decide are more interested in total customers per day then you could just find the intTimes with in a given time range (each day) & probably just ignore the outTimes all together.

Rank dates in Tableau

How can I rank dates on Tableau?
By customer, I have a list of codes banked (every code has an ID and an issue day) and I am interested in calculating the number of days between the first banked code and (as exemple) the 10th code (the difference will be calculated on the issue days).
Some people may have 1 code, some 2, some 10, some 100, etc. I'm only interested in calculating this metric when the number of codes banked is > 9.
The result will be, by customer, Code 10 Issue Date - Code 1 Issue Date.
So I expect that most engaged customers will bank 10 codes in 10 days, less engaged customers will bank 10 in more days.
EDIT: added below an example of the data source (first three columns) and the missing fields to be calculated (last two columns)

Find and Rank Time Series MATLAB

I know there must be a simple way that I can learn to do this but I cannot imagine how to start. I am tasked with finding a top 10 matching daily wind power time series in a 30-day plus/minus window from the first day in the time series (Jan 1st) matching a single daily wind power time series and it is out of my level of experience in MATLAB. I have successfully done this matching a single time series of the current year with the exact calendar days from previous years, but I need a more robust searching method to find the best correlated time series in a +/- window of time. For example, I'm comparing a 120 day time series (without leap years) with 25 previous years during the same 120-day period (Jan-Apr). The end result will show me the top 10 time series with the years and Julian day or cumulative day listed and a correlation or RMSE value associated with it. My data looks like this arranged in a 365 (days) X 25 (years) array and I thank you very much for your help!
1182573 470528 1638232 2105034 1070466 478257 1096999
879997 715531 1111498 1004556 1894202 1372178 1707984
636173 937769 2119436 742710 1625931 1275567 1228515
967360 1103082 2218855 1643898 1822868 554769 1325642

Calculate how many years there's left on a debt and print it in date format

I'm using Google Docs Spreadsheet and I want to calculate how many years there is left on a debt from a fixed date (YYYY-MM-DD), into a date (same formation).
Example: I started to pay off on a debt which are on 20 000, 2014-03-31. Every month, I'll pay 200 and the debt will be payed off 2022-03-31. If I change the pay sum (200) to another sum, the date will be based on the new sum and change the final debt year.
How can I accomplish this?
If you are satisfied with a more or less exact solution, you can write:
=A1+(30*D1/D2)
where:
A1 is your starting date (in date format), such as: 2014-03-31
D1 is your total amount of debt, in this example: 20000
D2 is your monthly sum of debt payed, in this example: 200
The formula simply counts how many months you need to clear the debt (D1/D2, which gives 100), and then multiples it by the average days of a month (30). Then it adds this amount of days to the starting date. Actually this example gives the result: 2022-06-17 as the final clearance of the debt.
As I said it's not fully exact as it counts 30 days as an average month and it does not count loop years, but I think that it can be used for your purpose.
I hope it helps.
UPDATE:
You'll get a little closer result to the exact value, if you use this:
=A1+(365*quotient(D1/D2,12))+(30*MOD(D1/D2,12))
The QUOTIENT function will calculate how many years are needed (in the example D1/D2 divided by 12). We multiply this value with 365 (the number of days in a year).
Then the MOD function calculates how many more months are needed after the years, which is the modulo of "D1/D2 divided by 12".
This function will give 2022-07-27 as a result for this example.