View Single Post
  #16   Report Post  
Posted to microsoft.public.excel.worksheet.functions
 
Posts: n/a
Default Formula Needed...

Hello Douglas,

I suggest to enter as UDF:

Function one_dim_array2(rI As Range) As Variant
'Converts an argument array of frequencies and values into
'a one-dimensional array.
'Example:
'3 25
'1 10
'4 12
'6 7
'will become 25 25 25 10 12 12 12 12 7 7 7 7 7 7.

Dim vR As Variant
Dim r As Range
Dim b As Boolean
Dim lF As Long, i As Long, j As Long

j = 0
For i = 1 To rI.Rows.Count
j = j + rI.Cells(i, 1).Value
Next i

ReDim vR(1 To j)

i = 1
b = True
For Each r In rI
If b Then
lF = r.Value
Else
Do While lF 0
vR(i) = r.Value
i = i + 1
lF = lF - 1
Loop
End If
b = Not b
Next r

one_dim_array2 = vR

End Function


Then enter into any cell =AVERAGE(one_dim_array2($A$1:$B$4)) or other
desired functions like MEDIAN, MODE, SKEW, KURT...

Please notice that this UDF assumes frequencies first, then values
(your example is the other way round).

HTH,
Bernd