# Formula identify group and average weight

on
I need a formula to count the number of grouped packages then show the average weight.
The conditions for the package groups:
Where columns A, B, F, I J K L match, then count rows and average the rated weight (column G).
The result will be in column P.

The issues - the ranges will change each time, but the columns will always be the same.

Ultimately, this will be part of the VBA code.

Any help?
test.xlsx
Comment
Watch Question

Do more with

EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2016
Commented:
HI,

pls try

``````=SUMIFS(H:H,A:A,A2,B:B,B2,F:F,F2,I:I,I2,J:J,J2,K:K,K2,L:L,L2)/COUNTIFS(A:A,A2,B:B,B2,F:F,F2,I:I,I2,J:J,J2,K:K,K2,L:L,L2)
``````

Or

``````=AVERAGEIFS(H:H,A:A,A2,B:B,B2,F:F,F2,I:I,I2,J:J,J2,K:K,K2,L:L,L2)
``````
Regards
Top Expert 2015

Commented:
You can use this formula in row-2..

``````=SUMPRODUCT((\$A\$2:\$A\$170=A2)*(\$B\$2:\$B\$170=B2)*(\$F\$2:\$F\$170=F2)*(\$I\$2:\$I\$170=I2)*(\$J\$2:\$J\$170=J2)*(\$K\$2:\$K\$170=K2)*(\$L\$2:\$L\$170=L2)*(\$G\$2:\$G\$170))/SUMPRODUCT((\$A\$2:\$A\$170=A2)*(\$B\$2:\$B\$170=B2)*(\$F\$2:\$F\$170=F2)*(\$I\$2:\$I\$170=I2)*(\$J\$2:\$J\$170=J2)*(\$K\$2:\$K\$170=K2)*(\$L\$2:\$L\$170=L2))
``````

Or simple...

``````=AVERAGEIFS(\$G\$2:\$G\$170,\$A\$2:\$A\$170,A2,\$B\$2:\$B\$170,B2,\$C\$2:\$C\$170,C2,\$F\$2:\$F\$170,F2,\$I\$2:\$I\$170,I2,\$J\$2:\$J\$170,J2,\$K\$2:\$K\$170,K2,\$L\$2:\$L\$170,L2)
``````

Saurabh...

Commented:
@Rgonzo1971 Something isn't working, for instance -
Bill_Recipient, 12/19/2014, 8691,  27 FORGE PKWY, FRANKLIN,       MA, 2038
the weight total is 135lb and there are 3 packages. Those 3 packages should result in
135/3 = 45, but I get the same weights as the rated weight in column G.
18.9
56.7
56.7

Commented:
@Saurabh Singh Teotia Something isn't working, for instance -
Bill_Recipient, 12/19/2014, 8691,  27 FORGE PKWY, FRANKLIN,       MA, 2038
the weight total is 135lb and there are 3 packages. Those 3 packages should result in
135/3 = 45, but I get the same weights as the rated weight in column G.
18.9
56.7
56.7
Top Expert 2015

Commented:
Euro,

That is not matching because 27 FORGE PKWY   is not equal to 27 FORGE PARKWAY  so then your results are 58+58 /2 = which is 58 only...

I'm referring to row number-->10 to 12

Saurabh...

Commented:
Sorry - my mistake!! This worked fine. Thank you !!!!

Do more with