I'm trying to average values in columns E, F, G ... based on which key they have in column A.
I have an excel formula that works, I got it from adapting this post: =AVERAGEIF(A:A,0,E:E). However, there are potentially n keys (up to 100000), and m columns of values (up to 100)
My problem is that typing in that formula for each variation isn't logical. Is there a better way to do this; so that it takes into account the varying groups and columns?
NOTE
- The first 7 rows are junk (they contain info about the file)
- The data is in CSV format, I am only using Excel to open it
- I am currently looking into modifying this script, but as I am unfamiliar with python so it may take some time
EXAMPLE
Column A is the group, column E are the values to be averaged. Column F contains the output averages (this is a little messy because it doesn't show which groups the averages are for, but they are just in ascending order, ie: 0, 1, 2)

ngroups (up to 100k), means that there arenunique group names which should each have their own set of averages.mcolumns is the number of columns that have values that should be averaged. the columns aren't combined, so if there are 5 columns of values, there will be 5 columns of averages