+ Reply to Thread
Results 1 to 11 of 11

Macro to take average of scores across individuals

  1. #1
    Registered User
    Join Date
    04-23-2012
    Location
    Toronto, Ontario
    MS-Off Ver
    2003
    Posts
    18

    Unhappy Macro to take average of scores across individuals

    Hi - Can anyone please help me with a macro - I have a workbook with coulumns for questions and rows for names. Under the questions column - individuals will enter a score. i will take those scores and avegrage them out across columns and rows as well. so i have an average per question and an average per person. I am attaching my excel file here.

    The score values will range from 0, 1,2,3,4,N/A
    if the score is 0 i will count it in my sum and in my average as well.
    if score value is N/A - i will not count this in my sum or my average - which means that if a person, Tom, has entered 1,3,4,N/A for the 4 questions then his average will exclude the N/A - so i will take a sum of 1+3+4 = 8 and divide that by 3 instead of 4 to get the average score for that person.

    I will be calculating the average in a Summary right below the raw data table.

    Concatenate Help.xls

  2. #2
    Valued Forum Contributor
    Join Date
    03-16-2012
    Location
    Aarhus, Denmark
    MS-Off Ver
    Excel 2007
    Posts
    992

    Re: Macro to take average of scores across individuals

    You could just use =AVERAGE(B25:E25) and copy down. It only averages cells containing numbers.
    Sincerely
    S?ren Larsen

    "Give a man a fish, and you'll feed him for a day. Give a man a fishing rod, and he'll steal your yacht!"

  3. #3
    Registered User
    Join Date
    04-23-2012
    Location
    Toronto, Ontario
    MS-Off Ver
    2003
    Posts
    18

    Re: Macro to take average of scores across individuals

    Sorry - i forgot to mention that my raw data is dynamic - the number of rows will increase with time. but the names of the individuals will remain the same i.e. Tom, Harry, Peter etc. i will have their names already in the Summary rows at the bottom of my excel workbook. Also - i need to exclude the count of N/A from my average

  4. #4
    Registered User
    Join Date
    04-23-2012
    Location
    Toronto, Ontario
    MS-Off Ver
    2003
    Posts
    18

    Re: Macro to take average of scores across individuals

    my rows will increase but my columns will not. so whatever questions are there in the columns - they wont change. as a row is added to my table - my summary should include it in its calculations. the other thing to notice is that the name in the rows is not in any order. but in summary i will have one row for each individual. for exampel - if am looking at my row "Peter" in my summary rows - i only want to take the avergae of his scores..so maybe a sumif kind of a formula could work? i am using excel 2003!

  5. #5
    Valued Forum Contributor
    Join Date
    03-16-2012
    Location
    Aarhus, Denmark
    MS-Off Ver
    Excel 2007
    Posts
    992

    Re: Macro to take average of scores across individuals

    If you use the =AVERAGE() function, then "N/A" is automatically excluded.

    I think the following might work, but I'm not sure:
    If you have your arrays in the =AVERAGE() function exceed your data by 1 row, then as more rows with data are added, then your arrays will automatically expand.

    To take the average of each person, perhaps you could use =AVERAGEIF()...
    Last edited by Søren Larsen; 04-24-2012 at 12:57 PM.

  6. #6
    Registered User
    Join Date
    04-23-2012
    Location
    Toronto, Ontario
    MS-Off Ver
    2003
    Posts
    18

    Re: Macro to take average of scores across individuals

    dont think excel 2003 has averageif

  7. #7
    Valued Forum Contributor
    Join Date
    03-16-2012
    Location
    Aarhus, Denmark
    MS-Off Ver
    Excel 2007
    Posts
    992

    Re: Macro to take average of scores across individuals

    Ahh, didn't see that.

    =AVERAGE(IF("array with names"="name","array with scores")) confirmed with Ctrl+Shift+Enter

  8. #8
    Registered User
    Join Date
    04-23-2012
    Location
    Toronto, Ontario
    MS-Off Ver
    2003
    Posts
    18

    Re: Macro to take average of scores across individuals

    that works!! thanks Soren - however - what if there is no score for a particular name i.e. Tom entered no scores - but in my summary - i still have to show Tom in my average rows. If he entered no score - then i should just see (blank) for his average - how do i adjust the above formula to match that? basically am looking for an iferror formula - the one that we have in excel 2010. excel 2003 does not have it...

  9. #9
    Valued Forum Contributor
    Join Date
    03-16-2012
    Location
    Aarhus, Denmark
    MS-Off Ver
    Excel 2007
    Posts
    992

    Re: Macro to take average of scores across individuals

    You could use:

    =IF(ISERROR("your formula"),"";"your formula")

  10. #10
    Registered User
    Join Date
    04-23-2012
    Location
    Toronto, Ontario
    MS-Off Ver
    2003
    Posts
    18

    Talking Re: Macro to take average of scores across individuals

    Thanks Soren! This works perfectly fine

  11. #11
    Valued Forum Contributor
    Join Date
    03-16-2012
    Location
    Aarhus, Denmark
    MS-Off Ver
    Excel 2007
    Posts
    992

    Re: Macro to take average of scores across individuals

    I'm very glad!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1