Calculating Geometric Mean w a large data set

z168

Board Regular
Joined
Nov 4, 2009
Messages
165
I have a data set of 11,000 numbers with no more than 2 digits per number. I have to get the geometric mean but excel 2010 limits to 5.0748E+307 (or roughly less than a 1000 points).

is there a workaround that I can tackle this?

thank you
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
I got a PM to resolve this question. so here it goes

Step1: convert all numbers to Logarithm; formula is =ln(x)
Step2: add all converted numbers
Step3: divide the sum total of the logarithms by the total count
Step4: do the inverse log, and there is your geometric mean; formula is =exp(x)
 
Upvote 0
Below is UDF for calculating of Geometric Mean of a large data set.
Usage in formula: =GeometricMean(A1:B10000)
Rich (BB code):
Function GeometricMean(Rng)
' ZVI:2014-06-03 http://www.mrexcel.com/forum/excel-questions/693777-calculating-geometric-mean-w-large-data-set.html
  Dim a, x
  Dim n As Double, v As Double
  Dim vt As VbVarType
  If IsArray(Rng) Then a = Rng Else a = Array(Rng)
  For Each x In a
    vt = VarType(x)
    If vt > 1 And vt < 7 Then
      If x > 0 Then
        n = n + 1
        v = v + Log(x)
      End If
    End If
  Next
  If n Then GeometricMean = Exp(v / n) Else Err.Raise 13
End Function
 
Upvote 0
Or via formula, confirmed with Ctrl+Shift+Enter

=EXP(AVERAGE(LN(A1:A11000)))
 
  • Like
Reactions: ZVI
Upvote 0
Or via formula, confirmed with Ctrl+Shift+Enter

=EXP(AVERAGE(LN(A1:A11000)))
Hi Shg,

For regret LN(A1:A11000) has the same overflow limitation.
For example, LN(A1:A1000) returns #NUM! if cells A1:A1000 are populated by 3

Vlad
 
Last edited:
Upvote 0
Corrected: LN(A1:A1001) fails for A1:A1001 = 3
 
Upvote 0
Not seeing that result, ZVI, e.g., for A1:A11000 = 9E307.
 
Upvote 0
Shg, I'm apologizing.
You formula works well, it was empty cell in my testing range. UDF skips such cells.
Vlad
 
Upvote 0
A fair point; it should ignore empty cells.

=EXP(AVERAGE(IF(ISNUMBER(A1:A11000), LN(A1:A11000))))
 
Upvote 0

Forum statistics

Threads
1,225,804
Messages
6,187,111
Members
453,408
Latest member
Valsauvage

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top