Commander Vimes
New Member
- Joined
- Aug 8, 2016
- Messages
- 11
So i've been struggling with this. Is there a way to calculate the median of a set of values based on Name and volume? An example of the data layout is below, what i want is to calculate the median value for a large table with multiple entries using formula or VBA.
[TABLE="width: 500"]
<tbody>[TR]
[TD]Name[/TD]
[TD]Volume[/TD]
[TD]Value[/TD]
[/TR]
[TR]
[TD]Dog[/TD]
[TD]1[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]Dog[/TD]
[TD]1[/TD]
[TD]2.5[/TD]
[/TR]
[TR]
[TD]Dog[/TD]
[TD]3[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]Cat[/TD]
[TD]1[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]Cat[/TD]
[TD]2[/TD]
[TD]3.6[/TD]
[/TR]
[TR]
[TD]Duck[/TD]
[TD]5[/TD]
[TD]5[/TD]
[/TR]
</tbody>[/TABLE]
Using the example above i would want to calculate the median for Dog, Cat and Duck.
Using Cat as an example, the figures there would be 1 x Cat=2 and 2 xCat=3.6.
Median would be 3.6: (2, 3.6, 3.6)
So is there a formula or macro Vba which would look at the Name and volume and then calculate the Mean of the value for each unique Name?
-CV
[TABLE="width: 500"]
<tbody>[TR]
[TD]Name[/TD]
[TD]Volume[/TD]
[TD]Value[/TD]
[/TR]
[TR]
[TD]Dog[/TD]
[TD]1[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]Dog[/TD]
[TD]1[/TD]
[TD]2.5[/TD]
[/TR]
[TR]
[TD]Dog[/TD]
[TD]3[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]Cat[/TD]
[TD]1[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]Cat[/TD]
[TD]2[/TD]
[TD]3.6[/TD]
[/TR]
[TR]
[TD]Duck[/TD]
[TD]5[/TD]
[TD]5[/TD]
[/TR]
</tbody>[/TABLE]
Using the example above i would want to calculate the median for Dog, Cat and Duck.
Using Cat as an example, the figures there would be 1 x Cat=2 and 2 xCat=3.6.
Median would be 3.6: (2, 3.6, 3.6)
So is there a formula or macro Vba which would look at the Name and volume and then calculate the Mean of the value for each unique Name?
-CV