+ Reply to Thread
Results 1 to 9 of 9

Dynamic Average if formula

  1. #1
    Registered User
    Join Date
    04-19-2022
    Location
    Bristol, England
    MS-Off Ver
    Professional Plus 2021
    Posts
    24

    Dynamic Average if formula

    Hi all,

    I need a formula to calculate an average score (Col I) of a person (Col F) but the average range will move around so it needs to be dynamic (i.e. use column that contains "M2")

    Example worksheet attached.

    The formula should be entered into B2,3,4.

    I am using excel at the moment but this will be used in Google sheets so ideally I need the formula to work in google sheets.

    Thanks in advance
    Dc
    Attached Files Attached Files

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2411
    Posts
    26,667

    Re: Dynamic Average if formula

    Do you simply want the average of the values in column I for each person? Enter the formula in row 2 and copy down.

    Values as displayed
    A
    B
    C
    1
    M2
    Answer
    2
    Tim
    3.5
    3
    Sue
    4.3
    4
    Fred
    4.0

    Underlying formulas
    A
    B
    C
    1
    M2
    Answer
    2
    Tim
    =AVERAGEIF($F:$F,$A2,$I:$I)
    3
    Sue
    =AVERAGEIF($F:$F,$A3,$I:$I)
    4
    Fred
    =AVERAGEIF($F:$F,$A4,$I:$I)
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    04-19-2022
    Location
    Bristol, England
    MS-Off Ver
    Professional Plus 2021
    Posts
    24

    Re: Dynamic Average if formula

    Not quite. You have entered I:I for the sum range. This column will move around so I need that element to be dynamic.
    It needs to find the column header that contains "M2" for example and then use that cell range. One week it will be I:I the next it will be K:K and I don't want to manually correct it each time.

    Thanks
    DC

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2411
    Posts
    26,667

    Re: Dynamic Average if formula

    OK, I didn't understand that from your post. Updated formula.

    Values as displayed
    A
    B
    C
    1
    M2
    Answer
    2
    Tim
    3.5
    3
    Sue
    4.3
    4
    Fred
    4.0

    Underlying formulas
    A
    B
    C
    1
    M2
    Answer
    2
    Tim
    =AVERAGEIF($F:$F,$A2,OFFSET($A:$A,0,MATCH("M2 Assessment",$1:$1,0)-1))
    3
    Sue
    =AVERAGEIF($F:$F,$A3,OFFSET($A:$A,0,MATCH("M2 Assessment",$1:$1,0)-1))
    4
    Fred
    =AVERAGEIF($F:$F,$A4,OFFSET($A:$A,0,MATCH("M2 Assessment",$1:$1,0)-1))

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,181

    Re: Dynamic Average if formula

    In B2 copied down:

    =LET(f,FILTER($G$2:$J$15,$F$2:$F$15=A2),AVERAGE(FILTER(f,LEFT($G$1:$J$1,2)=$B$1)))
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  6. #6
    Registered User
    Join Date
    04-19-2022
    Location
    Bristol, England
    MS-Off Ver
    Professional Plus 2021
    Posts
    24

    Re: Dynamic Average if formula

    Thank you.... that works except for the hardcoded "M2 Assessment". How can I amend that to link to cell B1 where B1 only contains part of the header i.e. M2.

  7. #7
    Registered User
    Join Date
    04-19-2022
    Location
    Bristol, England
    MS-Off Ver
    Professional Plus 2021
    Posts
    24

    Re: Dynamic Average if formula

    Thank you Ali, that works. Hopefully that will work in Google sheets as well.

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,181

    Re: Dynamic Average if formula

    Should do, but if you want solutions for GoogleSheets, you should be posting in the Other Platforms section.

    Glad to have helped.

    If that takes care of your original question, please choose Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, if you have not already done so, you may not be aware that you can thank anyone who offered you help towards a solution for your issue by clicking the small star icon (* Add Reputation) located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of each of those who offered help.

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,181

    Re: Dynamic Average if formula

    Thanks for the rep, but you forgot to mark the thread as SOLVED. Please do so.

+ 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. AVERAGE formula for dynamic range
    By TheRobsterUK in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-08-2019, 10:46 AM
  2. Dynamic Average Formula across multiple worksheets
    By junglenrg in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 12-08-2016, 01:23 PM
  3. [SOLVED] Dynamic Average of Difference Formula
    By skywriter in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-13-2015, 04:35 PM
  4. [SOLVED] sum() and average() formula with dynamic columns
    By umbata in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-25-2015, 12:29 PM
  5. [SOLVED] average formula for dynamic range
    By rossg in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-01-2014, 07:41 AM
  6. Dynamic Range and Average Formula
    By molfetta55 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-25-2014, 09:54 AM
  7. Dynamic range in average formula
    By Cicada in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-09-2011, 02:08 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