Google sheet average function results the wrong average value - google-sheets

I am trying the average function to calculate the average of the number in column, but it gives the wrong result. All are numbers, I have also checked by applying ISNUMER() function.
below is the screenshot
Actual average value of A1 to A3 should be 60074.67, but average function gives different result.
What is wrong in my function?

Seems like you are only calculating the average of cells A1 and A3.
For the whole range try
=AVERAGE(A1:A3)
and see if that helps?

Related

how do I convert a negative number into a positive one?

I want to show positive movement in numbers. In my case moving from 4 to 3 is positive movement.
In my Google Sheets, I have 4 in cell B1 and 3 in C1. The percent change value is 1 and percent change is 33% improvement. If I use this formula =(b1-a1)/b1 I get -33%. What formula do I use to get 33% as the returned percent?
Try using ABS() function. Something like this:
ABS((b1-a1)/b1)
try like this:
=((B1-A1)/B1)*-1

How to get average for last N rows with specific formula

I would like to calculate an average and this is my current formula
=iferror(iferror(AVERAGE(AVERAGEIF(B$2:B2156,B2157,D$2:D2156),AVERAGEIF(C$2:C2156,B2157,E$2:E2156)),AVERAGEIF(C$2:C2156,B2157,E$2:E2156)),AVERAGEIF(B$2:B2156,B2157,D$2:D2156))
This will calculate average between all cells up to 2156 but I would like to give me average only for last 10 hits. I tried with adding offset but I'm not sure where exactly to put it
Here is an example of my sheet
So I would like to get always the average of last 10 games for a home team.
You may use indirect & max method to average Last N row to solve your proble:
=average(INDIRECT("C"&max(0,count(C:C)-9)&":C"&max(0,count(C:C))))
Result:

How do I create an arrayformula to calculate the median of three different values from one row?

How do you create an arrayformula to calculate the median of three different values from one row in google sheet?
For example, I want to do ARRAYFORMULA for MEDIAN formula.
=ARRAYFORMULA(MEDIAN(A2:A,$B$2,$C$2))
where
A2: start date - 2020-07-22 10:00
B2: start hour - 8:00
C2: end hour - 17:30
And the result of MEDIAN(A2:A,B2,C2) is 10:00, but ARRAYFORMULA does not work. (the result is 00:00:00)
is it possible to make an Array for MEDIAN? Or is there any option to do that in other way?
Mean and median are not the same. Mean is essentially AVERAGE, while MEDIAN is the "middle-most" value in a set:
=AVERAGE(2,1,9) returns 4 [i.e., (1+2+9)/4 ]
=MEDIAN(2,1,9) returns 2 (i.e., the value in the middle if all the numbers were lined up from lowest to highest)
If you only have to compare three columns, you could get by with a sort of "brute force" value-to-value comparison array. For instance, in D2:
=ArrayFormula(IF(((A2:A-INT(A2:A)<B2:B)*(A2:A-INT(A2:A)>C2:C))+((A2:A-INT(A2:A)>B2:B)*(A2:A-INT(A2:A)<C2:C)),A2:A-INT(A2:A),IF((B2:B<(A2:A-INT(A2:A))*(B2:B>C2:C))+(B2:B>(A2:A-INT(A2:A))*(B2:B<C2:C)),B2:B,C2:C)))
In English, this says:
"If the first value is lower than the second AND higher than the third, OR if the first value is higher than the second AND lower than the third, it is the median. Return the first value.
If neither of those is true, check to see if the second value is lower than the first AND higher than the third, OR if the second value is higher than the first AND lower than the third. If so, it is the median. Return the second value.
If nothing has been true so far, then the third value must be the median. Return the third value."
The one additional thing is you'll notice I have E2:E-INT(E2:E). This gets rid of the date portion and leaves only the time, since in Google Sheets, dates are whole numbers while times are decimal portions less than 1. So removing the INTeger (i.e., whole) part of the cell value leaves only the decimal portion, which is the time. This is necessary so that the comparisons can be of-a-kind.
arrayformula for average:
=ARRAYFORMULA(TEXT(QUERY(TRANSPOSE(QUERY(TRANSPOSE(N(A2:C*1)),
"select "&TEXTJOIN(",", 1, IF(A2:A="",,
"avg(Col"&ROW(A2:A)-ROW(A2)+1&")"))&"")),
"select Col2"), "hh:mm"))
arrayformula for MEDIAN now possible:
=IFERROR(BYROW(A2:C10, LAMBDA(xx, TEXT(MEDIAN(xx), "hh:mm"))))

ArrayFormula Google Sheets - remove high and low from average

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

Nested Average(Small(offset)) in Sheets isn't producing correct result

I want to calculate the average of the smallest 20 numbers in a range (using offset), then multiply it by 0.96 using a Google sheet.
This is the formula we have:
=AVERAGE(SMALL(OFFSET(B13,2,0,20),{1;2;3;4;5;6;7;8;9;10}))*0.96
(See below for pictures)
The function should output 24, but instead it's outputting 14. I think it has something to do with the range of numbers for 'n' in the nested 'small' function, but for the life of me I can't figure out what it is. I've linked some pictures:
Thank you!
Since the data in your image only has 20 rows, i am assuming you mean to calculate average of smallest 10 numbers from the 20 rows. Try this formula
=AVERAGE(SMALL(OFFSET(B13,0,0,20,1),{1,2,3,4,5,6,7,8,9,10}))
Please note the the formula should be entered as an array i,.e. type the formula and press Ctrl + shift + enter

Resources