+ Reply to Thread
Results 1 to 8 of 8

formula to work out annual averages based of the corresponding date in adjacent column??

  1. #1
    Registered User
    Join Date
    02-01-2021
    Location
    Birmingham
    MS-Off Ver
    2016
    Posts
    27

    Question formula to work out annual averages based of the corresponding date in adjacent column??

    Hello,
    I have a spreadsheet with different people's scores for a test over time:
    A1:A1000 contains names
    B1:B1000 contains test 1 scores
    C1:C1000 contains test 1 dates
    D1:D1000 contains test 2 scores
    E1:E1000 contains test 2 dates etc. with space for up to 100 tests per person to be recorded.
    I am looking to create a formula that will calculate the annual average scores for each person for every year from 1995 to 2020, and these will be at the end of each row under the headings "1995 annual average" to "2020 annual average". This means the scores to be included for the calculation of each yearly average are dependent on their date. For example the 2017 calculation should only be an average of the scores with a corresponding date in the year 2017.
    I have tried labelling the data rage B:B,D:D,F:F,H:H...GS:GS "scores" and the data range C:C,E:E...GT:GT "dates" to put into the formula. I have tried a few variations including:
    AVERAGEIF(dates,AND(>=01/01/2017,<=31/12/2017),scores)
    AVERAGEIFS(scores,dates">="&01/01/2017,dates"<="&31/12/2017)
    IF(AND(dates(>=01/01/2017,<=31/12/2017),AVERAGE(scores)))
    These all come up with errors, I have also tried using =YEAR(2017) as the criteria and this won't work either. I am also not sure if I am being specific enough in these formulas to pick out the correct cells to use in each average based off the criteria of the date in the next cell - is this possible?
    Any suggestions would be much appreciated, Thanks

    EDIT: I Have added an example sheet showing the basic layout. We have multiple tests being carried out up to 100 times for >1000 people so the best way to measure their progression for each test seems to be to calculate their yearly average scores and then use those values to input into pivot tables?
    Attached Files Attached Files
    Last edited by lilybickel; 02-08-2021 at 05:27 AM. Reason: solved

  2. #2
    Forum Expert
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    1,781

    Re: formula to work out annual averages based of the corresponding date in adjacent column

    Post a small Excel sheet (not a picture) showing realistic & representative sample data WITHOUT confidential information (10-20 rows, not thousands...) and some manually calculated results. Just before posting, scroll down to GO ADVANCED, click, and then scroll down to MANAGE ATTACHMENTS and click again. Now follow the instructions at the top of that screen.

  3. #3
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,714

    Re: formula to work out annual averages based of the corresponding date in adjacent column

    does your sheet have to be laid out that way? it would be a heck of a lot easier if you had names in column A, scores in column B, Dates in column C and an additional column "test" in column D indicating which test (test 1, test 2, test 3 etc) is referred to

  4. #4
    Registered User
    Join Date
    02-01-2021
    Location
    Birmingham
    MS-Off Ver
    2016
    Posts
    27

    Re: formula to work out annual averages based of the corresponding date in adjacent column

    I agree that would be easier, unfortunately we want to have a row per person as we have multiple tests and lots of different measurements to record and want each person's data in one place - please see my attached example

  5. #5
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,714

    Re: formula to work out annual averages based of the corresponding date in adjacent column

    ok, assuming that each person appears only once in their own row, and the test date is always in the column to the right of the test result, this user-defined function might work:

    Please Login or Register  to view this content.
    basically it looks for every cell in the specified range that contains a date and averages the values in the cells to the left of the dates if the years in the dates are the same as the year in the formula.

    for example

    =AnnAv(B3:K3,2017)

    should return the average of scores for the year 2017 in the range b3:k3

  6. #6
    Registered User
    Join Date
    02-01-2021
    Location
    Birmingham
    MS-Off Ver
    2016
    Posts
    27

    Re: formula to work out annual averages based of the corresponding date in adjacent column

    Thank you so much, yes that has worked!
    I have some tests where the score is classified and then rated (for example a score of 0-2 = classification of "low" = rating of 1; 3-4 = "moderate" = 2; 5-6 = "high" = 3) so the columns look like this:
    | SCORE 1 | CLASSIFICATION 1 | RATING 1 | DATE 1 | SCORE 2 | CLASSIFICATION 2 | RATING 2 | DATE 2 |
    I also need to the annual average rating as well as score for these tests:

    Please refer to test 2 in my attached "database example 2". I have set out sheet 1 to include columns for Score, Rating, and Date. I have adapted the function to make AnnAv2 where "Ccell.Offset(0,-2).Value" in order to find the average score, and I have used the original AnnAv function in order to find the average rating - this works fine.

    Sheet 2 has been set out to represent my actual database; I have included all the columns for Score, Classification, Rating, and Date. I have adapted the function to make AnnAv3 where "Ccell.Offset(0,-3).Value" in order to find the average score, and have used the original AnnAv function in order to find the average rating. The output of these functions all come up with a #VALUE! error. I assume this is because of the inclusion of words in the range. Do you have any suggestions for how I might overcome this error or is the only way around it to take out the classifications?
    Attached Files Attached Files

  7. #7
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,714

    Re: formula to work out annual averages based of the corresponding date in adjacent column

    hi

    I have had a quick look and it seems that the formula below is throwing it, but I can't work out why.

    =IF(U3<>"",IF(U3<=2,"low", IF(AND(U3>2,U3<=4),"moderate",IF(AND(U3>4,U3<=6),"high",""))))

    I have commitments all day tomorrow but will try to look at it again on the weekend

  8. #8
    Registered User
    Join Date
    02-01-2021
    Location
    Birmingham
    MS-Off Ver
    2016
    Posts
    27

    Re: formula to work out annual averages based of the corresponding date in adjacent column

    No worries, thank you so much for your help

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 5
    Last Post: 05-30-2019, 06:18 AM
  2. Auto-adjust # of rows in a column that have a formula based on adjacent column data?
    By Norcal1 in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 3
    Last Post: 05-31-2018, 02:03 PM
  3. Replies: 3
    Last Post: 12-16-2015, 05:56 PM
  4. [SOLVED] Day of the week based on date in adjacent column
    By mknispel in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-08-2014, 11:40 PM
  5. Sum based on date range by workdays in adjacent column
    By papasmurfuo9 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-15-2014, 10:31 AM
  6. Counting unique items on a list based on date in adjacent column
    By Mafoo17 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-30-2013, 04:24 PM
  7. Replies: 1
    Last Post: 01-05-2011, 05:18 PM

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