JenniferMurphy
Well-known Member
- Joined
- Jul 23, 2011
- Messages
- 2,531
- Office Version
- 365
- Platform
- Windows
I need to keep track of a series of ratings of several products. Each product will have one or more ratings on either a 0-10 or 0-100 scale. The number of ratings for each product will vary from 1 to some unknown number (probably less that 100).
Here's some sample data.
The only thing I could come up with is a little UDF to do the average. Here's that code:
Is there a better way?
Thanks
Here's some sample data.
The only thing I could come up with is a little UDF to do the average. Here's that code:
VBA Code:
Function ListCalc(pList)
Dim ListArray() As String
ListArray = Split(pList, " ")
Dim ListSum As Double
ListSum = 0
Dim ListCount As Long
ListCount = UBound(ListArray)
Dim i As Long
For i = 0 To ListCount
ListSum = ListSum + CDbl(ListArray(i))
Next i
ListCalc = ListSum / (ListCount + 1)
End Function
Is there a better way?
Thanks