I've set a Trendline for a Chart Series to Moving Average, but the Period only accepts a maximum of 10 periods.
The data is provided as Weekly Stock Prices, using GOOGLEFINANCE(), for the last 10 years.
I would like to see a trendline over a longer period, such as 26 (weeks). Ideally, I would specify this Period in a sheet cell, so I can change it depending on the stock I'm interested in.
One option I thought might work is to add an extra column that works out an average, and use that as another Series? However I don't know how to specify the number of Periods in such a calculated Average().
Is there any method to do this?
I finally found a function that allowed me to create a moving average, and used this for a third column which created another Series in the Chart. It is OFFSET(). This function can define a range which is relative to a specific cell. So the formula n cell C52 is :
OFFSET(B52,-($G$1-1),0,$G$1,1) Gets the range of previous cells for the avg, using cell G1 to vary the period required
AVERAGE(OFFSET(B52,-($G$1-1),0,$G$1,1)) Returns the average
=IFERROR(AVERAGE(OFFSET(B52,-($G$1-1),0,$G$1,1)), "") Error handler as the first (G2-1) cells can't return a range
Cell A2 gets the stock data for the last 10 years using:
=GOOGLEFINANCE(A1, "price", EDATE(TODAY(),-12*$E$1), TODAY(), "WEEKLY")
Related
I have 2000 rows of cost price data. In each row, I would like to apply a color scale to quickly highlight cost prices (from low to high). However, I would like the color scale comparison logic each time to be applied within a specific row. So row 12 data should not be compared to row 13 data for instance. How can I do this without creating 2000 rules stipulating each row?
I have done it for the first row as below:
D3:BL3
However, when I try $D3:$BL2000 and hit "Done" the $ signs just disappear meaning the formatting logic isn't applied at row level but all rows (so e.g. row 4 is compared to e.g. row 100).
You can't have a conditional formatting with scale color row by row with Google Sheets option. You can simulate it with the help of MIN, MAX and QUARTILE. Here you have an example:
=(D1=MAX($D1:$Z1))*(D1<>"")
=(D1>QUARTILE($D1:$Z1,3))*(D1<>"")
=(D1>QUARTILE($D1:$Z1,2))*(D1<>"")
=(D1>QUARTILE($D1:$Z1,1))*(D1<>"")
=(D1>MIN($D1:$Z1))*(D1<>"")
=(D1=MIN($D1:$Z1))*(D1<>"")
PS: remember to sort accordingly the rules. In the top the highest values (in green in my example) and in the bottom the lowest values
PPS: you could do something similar with the help of RANK or LARGE/SMALL, depending on your data
I want to show data for 4 weeks on a Google Sheets chart.
I have tried to do this and it is mostly ok as this is correct:
The X-axis shows the days of the week
The Y-axis is the weight number
Issues I have with my current implementation are:
I had to make a separate series for each week when I wanted it automatically group the data by week number. (I then can't name each series)
The data is off by one day. Monday's data doesn't show which means Tuesday's data is showing in place of Monday and so on.
Here is a link to the google sheet and a screenshot below: https://docs.google.com/spreadsheets/d/147RMW2JE7MoWz53EZuB-nHj-p_xeKez_ze_0mqq8NGA/edit?usp=sharing
My expected result would look more like this:
Here the lines are shown grouped by each week AND data is shown for each day
The reason why you are missing the first day of every week is that you have checked the Use row 1 as heeaders so every series will remove the first datapoint (monday in your case) and insert it as the label for that series (you can see that in the legend).
If you uncheck that checkbox and change your range for the X-axis so it goes from Monday to Sunday you get the correct graph.
The problem with the previous graph is that although all its datapoints are correct there is no legend. But unfortunately there is no way to insert a legend easily because you cannot go and change this manually, the label for each series has to come from the cells.
What you can do to work around this limitation is change your data so the label for each series sits on top of your data and keep the Use row x as headers checked:
Of course this is not the only solution, you can go on multiple ways here, copy the table in a single sheet for every week, or just live without labels. Stack the weeks horizontally so everyone has its week number on top of the weight column, etc
I'm trying to use an arrayformula to calculate the average across 7 columns while removing the max and min number from those columns. The tricky part is there is no preset limit on how may cell will be filled, each time its different.
I have the formula to calculate the average complete:
=ARRAYFORMULA(IF(ISBLANK($A$2:$A),"",IF($J$2:$J="Granted",($AO$2:$AO+$AP$2:$AP+$AQ$2:$AQ+$AR$2:$AR+$AS$2:$AS+AT2:AT)/6,0)))
I've tried using the Trimmean function but it isn't working with the array formula, =Trimmean(AO2:AU2,0.33) any suggestions on how to get it to work?
Assuming the values in the cells that you want to ignore are empty, you want :
Average of all cells that are filled and not maximum or minimum
Which is
Sum of all cells that are filled and not maximum or minimum / (number of filled cells - 2)
Thus
=(sum(YourRange)-max(YourRange)-min(YourRange))/(count(YourRange)-2)
should give you what you want
I am trying to make a schedule in Google Spreadsheets. One of the features I want here is to have the current activity highlighted based on the time of the day.
In the formula below, understand A as the column that contains times (first column on the picture), and B as the column that contains activities.
=AND(B$1=upper(TEXT(TODAY(), "DDDD")), (TODAY()+$A2)<NOW(), (TODAY()+$A2+(0.5/24))>NOW())
B$1=upper(TEXT(TODAY(), "DDDD")) checks that the day indicated at the top of the column is today
(TODAY()+$A2)<NOW() checks that the time is more that what's in the A column on the same line
(TODAY()+$A2+(0.5/24))>NOW() checks that the time isn't more than half an hour past what's in the A column on the same line
Using this conditional formatting formula, I obtain a decent result (see picture), but when it reaches a merged cell, it'll only work for the first half hour (in this picture, lunch will only be highlighted from 12:00PM to 12:29PM).
To correct that, my idea is to multiply 0.5/24 in the last part of the formula by the height (as in number of cells in height) of the merged cell
Is there a way to do this in Google Spreadsheets?
I have a row of values (say 1-10)
At the beginning of the rows I have 2 numbers generated from dates from other cells that represent week numbers. (eg, 3 and 9)
I want my row to highlight all the numbers from 1-10 that are between the values from the week number cells. (eg the cells with numbers 3,4,5,6,7,8 and 9 will automatically turn a colour (say green))
I've tried the conditional format, using the "between" values.
It doesn't work.
If I just type the numbers into the format box, it will work, but the problem is I need it to refer to the value in the cell NOT a number I type in, because there is a likelihood that the dates could change, which will affect the value shown in week number cell, so I need it to work automatically and not require me to go through every single row changing values for the formatting.
Is this even possible on sheets?
Thanks in advance, I am hoping I've just overlooked something simple.
Use a custom function for conditional formatting. For instance, if the columns you describe are in Row 2, this function will evaluate "TRUE" for numbers that are >= A2 and <= B2:
=AND(C2>=$A2,C2<=$B2)
Select the range of cells you wish to create a conditional format for; C2..L2, say. Open the conditional formatting dialog, and choose "Custom formula". Enter the formula above; note that itr refers to the top-left corner of the range you wish to apply the formula to - Sheets will automatically adjust it for the rest of the range, which is why it's important to use absolute references for the first two columns.