Hello i am working on building a EXCEL sheet that needs to average from multiable spots from within the spreadsheet. See example:

This is what it looks like (example)
a b c d
1 ab 1 5 a
2 ac 1 10 a
3 aa 2 10 z
4 af 1 15 x
5 aq 2 0 x
6 ap 2 5 r

This is what i need it to look like (e=average for matching (b) numbers)
a b c d e
1 ab 1 5 a 10
2 ac 1 10 a 10
3 aa 2 10 z 5
4 af 1 15 x 10
5 aq 2 0 x 5
6 ap 2 5 r 5

Step two:

a b c d e
1 ab 1 5 a 10
2 ac 1 10 a 10
3 aa 2 10 z 5
4 af 1 15 x 10
5 aq 2 0 x 5
6 ap 2 5 r 5

(Next work sheet)

a b
1 1 10
2 2 5


Been trying different things all day but havent figured it out yet.

Thanks, David