Show average of cells which display X text.

New Contributor




Please can you help create a formula for the below:..

average rate.PNG


In column M, what is the formula i would need if i wanted to take an average of column L, based on what text is based in column D.


I.e. M2, M3 & M4 are all Management and so Group Rate would be  £23.37

M5, M6 & M7 are all Admin, so Group Rate would be £10.16.


Column D would be a free text box, so theoretically the 'group name' could be called anything - i would just want them grouped together.



4 Replies

You could use the AVERAGEIFS() function to accomplish this. Specifically, for your case M2 would look like =averageifs($K$2:$K$7,$D$2:$D$7,D2). You can then drag this cell down for the whole column. 


You can look up the averageifs command for more information about how it is working.


Hi @philipo51617,


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.


2-20-2019 3-08-04 PM.jpg


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

2-20-2019 3-08-26 PM.jpg 


I hope this helps you accomplish what you're wanting to do!

thanks for quick response, will have a play round and see what works best.
The formula in M2, copied down to M7, is:
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.
Related Conversations