I am trying to extract value for a given Month, Day, and Time of the year. I am trying to find the distribution of Demand for a possible outcome of Demand for the next year (24 hours * 365 days = 8760 data points)
For example, if I want to find the distribution of past demand on January 1st then I want to extract the demand value for the January 1st in every year at a specific time of the day within the data frame.
I provided a picture below on what I am trying to achieve.
Let's call the past demand "Past Demand SS" and the Expected Demand "E_Demand SS".
"Past Demand SS" has 3 columns and 35041 rows.
"E_Demand SS" has 3 columns and 8760 rows.
Any ideas on how I can achieve this instead of entering it in manually?
Related
This question already has answers here:
Google Sheets: Moving daily, weekly, monthly, and yearly averages
(2 answers)
Closed 24 days ago.
I've got a data set of 365 cells about the wave height per day, I want to figure out how to find when the highest average over 15 days is during the year. I am limited to using google sheets and have beginer to intermediate knowledge of google sheets which makes it hard to figure out how to write the function.
I have no clue how to get there, all i could figure out online is using the function to find the highest 10 values in a dataset, but not consecutive values.
With the use of SCAN, SEQUENCE and INDEX, you can navigate through the range, choosing ranges of 15 cells; and returning the average:
=SCAN("",SEQUENCE(COUNTA(A1:A)-14),LAMBDA(a,v,AVERAGE(INDEX(A:A,v):INDEX(A:A,v+14))))
Just by wrapping that into MAX would give you only the value. If you need also the range, can do something like this:
=SCAN("",SEQUENCE(COUNTA(A1:A)-14),LAMBDA(a,v,{"Rows: "&v&" to "&v+14,AVERAGE(INDEX(A:A,v):INDEX(A:A,v+14))}))
That would return:
With the help of SORTN you'll be able to find the highest value (or values, just change the first 1 after the closure of SCAN with the value you want):
=SORTN(SCAN("",SEQUENCE(COUNTA(A1:A)-14),LAMBDA(a,v,{"Rows: "&v&" to "&v+14,AVERAGE(INDEX(A:A,v):INDEX(A:A,v+14))})),1,1,2,0)
To have the actual values, use:
=LAMBDA(ind,FILTER(A:A,ROW(A:A)>=C1,ROW(A:A)<(C1+15)))(INDEX(SORTN(SCAN("",SEQUENCE(COUNTA(A1:A)-14),LAMBDA(a,v,{v,AVERAGE(INDEX(A:A,v):INDEX(A:A,v+14))})),1,1,2,0),,1))
I really couldn't put the title into words very well. I will link a template spreadsheet below.
I've been working on a formula for hours now however I keep hitting dead ends. I'm unable to effectively do what I believe should be feasible. I'd give my attempts however I believe it would be of zero help, instead I'll explain my desired outcome.
I have a page with my employees, the E column isn't populated right now as I'd like to create a formula (ARRAYFORMULA so I don't have to paste a formula into each cell) to calculate the output based on a few conditions and values.
Vacation days are calculated as follows. The CEO gets 5, managers get 3 and assistants get 1. Extra vacation days based on points employees receive, 30 points or above is 5, 20 points or above is 3 and 10 or above point is 1.
Calculating the amount of vacation days employees have earned wasn't the hard part for me, it was having the formula subtract days based on how many vacation days have been used in the past 30 days.
We log vacations on the vacation page. The formula on the employees page needs to calculate how many vacation days each employee has used in the past 30 days only and subtract that from the total earned vacation days that employee has earned.
I'd like for the formula to use TODAY() to calculate 30 days in the past however for the sake of this example I'll use the date 06/09/2021 instead for continuity.
Sorry if I haven't explained this well or I'm asking too much in one go, I figured all the context is required.
Example sheet
I'm trying to come up with a function that will calculate a monthly budget from within a specified date range. I tried to use SUMIFS but I can't figure out how to isolate a specific month within the range.
Example:
We have a sheet with Google Ad campaigns, with a row for each campaign.
We are running one Google Ad campaign (A) from 2/15/20 to 5/15/20 with a total budget of $3000 from which I calculate a daily budget of $33.33.
We are running a second campaign (B) from 5/15/20 to 8/15/20, also with a budget of $3,000, from which I calculate a daily budget of $32.61.
=IF(NOT(ISBLANK(Start_Date)),Total_Budget/(End_Date-Start_Date),"")
In a separate sheet, I have Budget and Spend fields for each month. For May, I need it to calculate the total budget for 5/1-5/15 of Campaign A, and 5/15-5/31 of Campaign B.
I got this far (J is the Daily_Budget, G is the Start_Date, and H is the End_Date):
=SUMIFS(Google!J2:J30, Google!G2:G30,"<="&DATE(2020,5,1),Google!H2:H30,">="&DATE(2020,5,31))
Then I was at a loss for how to extrapolate the number of days from the range, so that I could then multiply them by the Daily Budget and then add them together.
I thought of going back to the sheet that contains the campaigns and adding columns for each month with a complicated conditional, and then just using SUM(), but I feel like there has to be a more elegant solution.
UPDATE
Per request, here is a link to the spreadsheet with the desired results manually entered: Click here. May & June show the campaign partial month overlaps. The result I'm ultimately going for is =(15*Google!J2)+(16*Google!J3).
UPDATE 2 (24Jun20)
Per request, I have shared the spreadsheet so that people can make a copy and experiment with formulas: Click here..
Any ideas?
Thanks,
Ty
I would use the function DATEDIF() (documentation here). You can set the first parameter as the first day of the month you are trying to calculate the number of days within it, and the second as the first day from another month. Example:
DATEDIF(DATE(2020, 1, 1), DATE(2020, 2, 1), "D")
You could probably make a custom function with this as well to input only the number of each month (and year, in case of leap years on February), but I don't have much experience with that unfortunately.
Here is a sample sheet of what I'm trying to accomplish
Basically, I am trying to get Column C to increase by one hour each hour based off of Column E start time. So if Mark starts at 6 when I check at noon it would show 6 hours for him etc.
https://docs.google.com/spreadsheets/d/16Mr3O0v_mCoEQhEBb1iPSayrE4yFlKevAdf-nXaZkKE/edit?usp=sharing
In your column C you can create a formula that references the current date time.
The formula I found in Google Docs is: HOUR(NOW()), which will pull the hour portion of the current datetime. The full formula would then be =HOUR(NOW())-E2 for the first cell in your worksheet.
I have a sheet that lists every day of the year and is updated on a daily basis. Next to each day is a percentage. I would like to display the day of the week that has the highest (and lowest) percentage when adding all relative days throughout the year. (i.e.: all Thursdays)
I am using this formula, which only partially works. It displays the day of the week, but seems to only reference the latest occurrence instead of all in Column A.
B2:
=iferror(INDEX($A4:$A,MATCH(MAX(B4:B),B4:B,0)),"")
B3:
=iferror(INDEX($A4:$A,MATCH(MIN(B4:B),B4:B,0)),"")
Link to a sample book: https://docs.google.com/spreadsheets/d/1_LP5MmmgW3i0zM6ziud9YrWfH5SvuHFbZH3OmRj9W6E/edit#gid=0
I hope this is enough information to understand what I am hoping to accomplish.. Is this possible in Google Sheets?
If I can get this to work my second goal would be to show the highest/lowest for the current month (or a specific month) in addition to the whole year.
Thanks!
Take a look at the shared spreadsheet and see if it does what you want.
https://docs.google.com/spreadsheets/d/1LL4Mgn_IWa-8W6Q0TythdMhBieVFt8ZiKI_UeO9ciTI/edit?usp=sharing
Added col L,O,R,and U for numeric day of week, current month,
current year, and month number. You can hide these columns.
I added some data for testing.