My recommendation would be to use a pivot table and VLOOKUP for this.
Start by selecting your data and inserting a pivot table in a new sheet. I'd use your column D data for the rows and an average of column L. By default, pivot tables use the sum, so you will need to update the Value Field Settings to average.
In column N, I would enter a VLOOKUP function. I made a very simplified version of your data in the screenshot below, but essentially:
Lookup value: your group rate name which is in my column A, your column D
Table array: I selected the fields from my pivot table (be sure to add $ before the row & column to hold the function to just those fields when you copy & paste the formula)
Col Index #: the averages are found in the second column, so I entered 2
Range lookup: I want an exact match, so I entered false
I hope this helps you accomplish what you're wanting to do!
The formula in M2, copied down to M7, is: =SUMPRODUCT((D$2:D$7=D2)*K$2:K$7,L$2:L$7)/ SUMIF(D$2:D$7,D2,K$2:K$7) The foregoing formula returns the weighted average, taking into consideration the maximum number of hours that can be claimed by each employee. The AVERAGE, AVERAGEIF, and AVERAGEIFS functions in Excel only return the simple average, ignoring any weighting factor.