ArrayFormula Google Sheets - remove high and low from average - google-sheets

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

Related

Conditional formatting at row level

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

Google Sheets: Chart: Increase Moving Average Trendline Period

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")

how can i make google sheet itrate over columns

I have a sheet like this how can make a cell in front of x under the sum column get the sum of the x count column and y get the sum y count column
of course, I use sum function on both but the issue I face is how to make the z ,x1,y1,z1 the same I try to fill it down but as you see in the picture it is wrong
how can I do it for 100 row ?
This formula seems to give the result you want:
={"Header","Sum";
ARRAY_CONSTRAIN(TRANSPOSE(D1:1),COUNTA(D1:1),1),
ARRAYFORMULA(MMULT(TRANSPOSE(N(D2:AJ10)),{SEQUENCE(ROWS(D2:AJ10),1,1,0)}))}
It places the two column labels in the first row, then transposes all of the header values into a vertical column in A2:A, but prevents any blank rows by using ARRAY_CONSTRAIN, and a check for the number of header values to transpose.
The main result is the Sums, calculated using MMULT. You need to enter the range of the cells you are going to sum over - I've used D2:AJ10, entered twice in the formula. MMULT can slow down performance the more cells it has to review, but this seemed fine for 33 columns by 9 rows. Test it out in your actual sheet, and report back if any issues.
REFERENCES:
ARRAY_CONSTRAIN To limit size of an array result, by # rows and # columns
MMULT The matrix product of two matrices. Can be used for summing, if one matrix is one dimensional (eg. a row or a column) with values of just 1.

Count number of times values increase in range - Google Sheets

how are you? I'm just not sure what to do here, but I surely can use your help!
I have a series of values in a row range, such as in the following:
1000 2000 1500 2100 3200
I need to figure out a google sheets formula to put in the 6th cell of this row that counts the number of times the value of any cell is greater than the one to the left of it. In this example, my result should be 3.
Is there any way that this can be done? In Excel or Google Sheets, either is great to learn.
Thank you
You can also try the following formula
=COUNTIF(QUERY({{"";TRANSPOSE(B2:F2)},{TRANSPOSE(B2:F2);""}},
"select Col1-Col2 offset 1 label Col1-Col2 ''",0), "<0")
Assuming you have data in A2:E, place the following in F2:
=ArrayFormula(IF(A2:A="",,MMULT(IF(B2:E>A2:D,1,0),SEQUENCE(4,1,1,0))))
Since there are only four columns that might be greater than others (B:E), you can structure it this way. MMULT is hard to explain, but it essentially multiplies everything in each row of one matrix (range) by everything in another range and then adds them. SEQUENCE just forms a column of four 1's by which to multiply then add together everything in each row of the first range. Since anything times 1 is the original number, this just serves to to row-by-row addition.
This formula will process as many rows as have data in A2:E.
try in 7th column on row 2:
=ARRAYFORMULA(MMULT(IF(A2:E4<B2:F4, 1, 0), {1;1;1;1;1}^0))

Is there calculation time limit in Google Sheet?

I'm using Array Formula in Google Sheet to calculate some values.
Each row has around 200 fields (from Google form).
Using the array formula, I've multiplied each column to a cell in another sheet (200 fields there).
The response has the no of units 1, 2, 3, ... and another sheet has price 5, 10, 100.
So, each unit is being calculated by its price to get a total value.
=ArrayFormula(IF(ISBLANK('Form Responses 1'!T2:T),0,'Form Responses 1'!T2:T * Data!T2))
Ok, then I've to find the total sum of all these results, for that, I'm using MMULT.
=MMULT(T2:EV100,TRANSPOSE(ARRAYFORMULA(COLUMN(T2:EV100)^0)))
Now, the actual problem is that the ArrayFormula is only showing the result (the value 0) to 104 rows only.
Is there a limitation on the amount of calculation? Or the rows will increase over time?
I've tried ArrayFormula in an isolated sheet, and it goes to the bottom.
Poor me.
I just noticed that the sheet attached with Google form had only 103 rows, that is why the arrayFormula was only showing results till 103 rows.
I added 1000 more rows and it expanded. But it is slower than before, I guess the calculations are being performed in my browser.

Resources