Everything is "correct" insofar as neither the calculator nor Sheets is making a mistake. Also, both sheets and the calculator can return either result if you ask them.
You are performing completely different mathematical calculations. If you look at my second example below you will see that the approach you choose can have a much larger impact depending on your data.
Let's say you have a restaurant and want to know what percentage a diner "typically" tips. You could average the tip percentage of each diner, that would be your 72.3% / 40% results.
If you wanted to know how the total of all tips collected compares to the total of all sales, that would be your 74.1 / 23.2% results
If those numbers are very close it doesn't matter. If they were quite different one might try to find out why.
In the case of the second example large bills represent only 1/3 of the "diners" however the percentage tipped on those is 20% vs 50% for small bills which skews the results of both calculations so it is important to understand the "purpose" of the calculation.
array_a: {18, 18, 20, 17, 15, 18, 16, 16, 9, 13, 4, 18, 11, 7, 18}
array_b: {24, 23, 24, 21, 22, 21, 21, 22, 18, 17, 12, 22, 15, 11, 21}
218 = SUM(array_a)
294 = SUM(array_b)
74.1% = 218/294
74.1% = SUM(array_a)/SUM(array_b)
72.3% = AVERAGE(INDEX(array_a/array_b))
An example in more detail:
array_a: {1, 5, 20}
array_b: {2, 10, 100}
=AVERAGE(INDEX(array_a/array_b))
=AVERAGE({1/2, 5/10, 20/100})
=AVERAGE({50%, 50%, 20%})
=40%
=SUM(array_a)/SUM(array_b)
=SUM({1, 5, 20})/SUM({2, 10, 100})
=26/112
=23.2%
=AVERAGE(F1:F15)
instead of=SUM(F1:F15)/15
. It has the benefit of not needing you to count the number of items being averaged as you do in SUM, and will also exclude text and blank cells from the calculation.average()
formula gets an incorrect result as well. See my updated answer.=sum(A1:A15) / sum(B1:B15)
or similar. See my answer and Why is an average of an average usually incorrect?