# Calculating the average(s) of top, middle and bottom quarter values

1. ## Calculating the average(s) of top, middle and bottom quarter values

Hi,
I have a large group of dairy cows producing milk, with different contents of fat and protein. I would like to calculate the average milk yield, fat and protein contents for the top 25 % of cows (a top quarter of all cows) according to the milk production. I would like to do the same calculation also for bottom quarter of cows according to milk yield, and for two middle quarters of cows. The number of cows producing milk is not constant but varies from milk control to milk control (monthly). (Eg. having 100 cows the calculations should refer to 25 cow with the highest milk yield, another calculation of the 25 cows with the lowest milk yield and two groups with 25 cows in each producing top middle nad bottom middle quantities of milk). I hope the question is clear
Thanks, Andrej

2. ## Re: Calculating the average(s) of top, middle and bottom quarter values

Not the most perfect solution but it might inspire others to add to this.

The biggest issue i see is when the number of records divided by 4 (to breakdown into the 4 groupings you want) is not exactly a whole number and does not breakdown the number of records into 4 equal parts.

In the example provided we have 27 records, i then rounded up 27/4 to 7. Therefore the formula for the top 25%, the second 25% and third 25% will all result in the average being correct rows 2 thru 8 for top 25%, rows 9 thru 15 for second 25% and rows 16 thru 22 for third 25%. However for the bottom 25% rows 23 thru 27 are calculated

There are currently 1 users browsing this thread. (0 members and 1 guests)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1