+ Reply to Thread
Results 1 to 33 of 33

Average without Duplicate Values

  1. #1
    Forum Contributor
    Join Date
    02-11-2024
    Location
    Chicago
    MS-Off Ver
    2021
    Posts
    102

    Average without Duplicate Values

    I have a predictive model for MLB games. I use the following formula to take averages of the last four numbers in a single column. But the numbers I am using are duplicates. I would like to keep this formula, but have it disregard the duplicate values. Is that possible? Thanks in advance.

    Please Login or Register  to view this content.
    Average Without Duplicates.xlsx
    Last edited by IdabaMalouki; 04-07-2025 at 03:55 PM.

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    6,296

    Re: Average without Duplicate Values

    This should work in 2021...

    In B164, enter

    =AVERAGE(TAKE(DROP(TAKE(UNIQUE(FILTER($A$2:$F$163,$E$2:$E$163<>"")),-4),,COLUMN(B164)-1),,1))

    and copy to C, E, and F....
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Forum Contributor
    Join Date
    02-11-2024
    Location
    Chicago
    MS-Off Ver
    2021
    Posts
    102

    Re: Average without Duplicate Values

    I receive a #NAME? error. I need it to take the average of the B column only, then C only, then E only, and then F only. Each column needs to be its own unique average. Does that make sense? Apologies, but I posted wrong cell numbers in the above code from an older sheet.

    I'm hoping there is some way to simply nest something into the AVERAGE code that just takes the average of the two unique numbers within 4 cells, and eliminates the duplicates.
    Last edited by IdabaMalouki; 04-07-2025 at 04:10 PM.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,422

    Re: Average without Duplicate Values

    2021 doesn't have TAKE or DROP.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  5. #5
    Forum Contributor
    Join Date
    02-11-2024
    Location
    Chicago
    MS-Off Ver
    2021
    Posts
    102

    Re: Average without Duplicate Values

    Quote Originally Posted by TMS View Post
    2021 doesn't have TAKE or DROP.
    Unfortunately, that's what I'm working with. What Excel V. has TAKE or DROP?

  6. #6
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    6,296

    Re: Average without Duplicate Values

    Sorry - I skipped Excel 2021, straight from 2016 to 365. Excel 365 has TAKE and DROP... try this, which is clunkier but may work with 2021

    B164:

    =LET(v,INDEX(UNIQUE(FILTER($A$2:$F$163,$E$2:$E$163<>"")),,COLUMN(B164)),AVERAGE(INDEX(v,COUNTA(v)),INDEX(v,COUNTA(v)-1),INDEX(v,COUNTA(v)-2),INDEX(v,COUNTA(v)-3)))

    copy to C, E, and F

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,422

    Re: Average without Duplicate Values

    Maybe this for column B, and dragged across for column C:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Adjust ranges for columns D:F.

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,422

    Re: Average without Duplicate Values

    Or, maybe just use Remove Duplicates before you do anything?

  9. #9
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,422

    Re: Average without Duplicate Values

    Excel 2024 has TAKE and DROP if you don't want a subscription version.

  10. #10
    Forum Contributor
    Join Date
    02-11-2024
    Location
    Chicago
    MS-Off Ver
    2021
    Posts
    102

    Re: Average without Duplicate Values

    Still no luck. The idea is to take the last 4 values in column B:

    5.00
    4.25
    4.25
    4.25

    And get the average of 5.00 and only 4.25.

    If the formula takes the AVERAGE of:

    5.00
    4.25
    4.25
    4.25

    The result is 4.44.

    But what I would like the formula to do is take the average of just 5.00 and 4.25, which is 4.63. So I need the formula to just take the 5.00 and 4.25 of the last four cells. The existing formula works fine, but averages the three 4.25 values with the 5.00 which throws the true average off. The difference between 4.44 and 4.63 is significant in baseball.

  11. #11
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,422

    Re: Average without Duplicate Values

    Edit: deleted. Please see next attempt.
    Last edited by TMS; 04-07-2025 at 05:48 PM.

  12. #12
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,422

    Re: Average without Duplicate Values

    Edit: deleted. Please see next attempt.
    Last edited by TMS; 04-07-2025 at 05:48 PM.

  13. #13
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,422

    Re: Average without Duplicate Values

    Edit: apologies. It requires a slight tweak.

    Or this?

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by TMS; 04-07-2025 at 05:47 PM.

  14. #14
    Forum Contributor
    Join Date
    02-11-2024
    Location
    Chicago
    MS-Off Ver
    2021
    Posts
    102

    Re: Average without Duplicate Values

    No luck. B163 is blank

  15. #15
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,422

    Re: Average without Duplicate Values

    Did you drag the formula across?

  16. #16
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,422

    Re: Average without Duplicate Values

    Updated file.

  17. #17
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    6,296

    Re: Average without Duplicate Values

    It depends on what you mean by "Unique" values - my formulas treated unique based on a complete repeat of the entire row, not just the numbers.
    Last edited by Bernie Deitrick; 04-07-2025 at 06:23 PM.

  18. #18
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,422

    Re: Average without Duplicate Values

    My latest formula determines the last four rows and then takes unique values based on columns A:F. Again, not based on just numeric values.

  19. #19
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2504
    Posts
    13,740

    Re: Average without Duplicate Values

    In the attached remove row 164. Then in H2 array enter
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Then copy/paste into I2, K2 and L2.

    This returned 4.625, 5.875, 3.375, and 5.625
    Format according to needs.

    I don't know if you have to array enter in Excel 2021 or not, but if you aren’t familiar with array-entered formulas array enter means the formula must be committed from edit mode by simultaneously pressing and holding down Ctrl and Shift while hitting Enter.
    Attached Files Attached Files
    Dave

  20. #20
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2504
    Posts
    13,740

    Re: Average without Duplicate Values

    This one is simpler than my previous and does not require deleting row 164 or array entry.

    In B164 and copy/pasted into C164, E164 and F164
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Format as Number with 2 decimal places and these will round automatically.

    They return 4.63, 5.88, 3.38 and 5.63
    Attached Files Attached Files

  21. #21
    Forum Contributor
    Join Date
    02-11-2024
    Location
    Chicago
    MS-Off Ver
    2021
    Posts
    102

    Re: Average without Duplicate Values

    That works great! However, in the sheet I use that formula, I was hoping to use it further down the sheet. For full clarity, I am attaching a new Excel sheet that shows all the calculations I will need using your formula. I will need your formula for cell B1153, C1153, E1153, and F1153. I tried using your formula in B1153. I tried switch B$2 with B$991, but it didn't work. Thanks in advance.

    Average Without Duplicates.xlsx

  22. #22
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2504
    Posts
    13,740

    Re: Average without Duplicate Values

    To which post are you referring?

    Edit: And by-the-way this looks like a completely different question with different logic and expectations.

    Please clarify. It appears you no longer want an average of unique last 4 values.
    Last edited by FlameRetired; 04-09-2025 at 02:32 PM.

  23. #23
    Forum Contributor
    Join Date
    02-11-2024
    Location
    Chicago
    MS-Off Ver
    2021
    Posts
    102

    Re: Average without Duplicate Values

    Quote Originally Posted by FlameRetired View Post
    To which post are you referring?

    Edit: And by-the-way this looks like a completely different question with different logic and expectations.

    Please clarify. It appears you no longer want an average of unique last 4 values.

    Sorry for confusion. I'm referring to your last post with simplified formula. Post #20.

    In the above new spreadsheet I posted, I need a formula that takes the average of the last 4 unique numbers in column B991 thru column B1152. You formula worked fine in the original spreadsheet I posted. But when I used your formula to take average in column B991 thru column B1152, it doesn't work.

  24. #24
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2504
    Posts
    13,740

    Re: Average without Duplicate Values

    Ok. I think I am understanding now. Will the data layout/groupings be the same throughout? If so this will require calculating dynamic ranges and will take me a while.

  25. #25
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2504
    Posts
    13,740

    Re: Average without Duplicate Values

    OK. It was a problem with the absolute cell references not applying to the new ranges.

    Try this in B164
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Then copy/paste to C164, E164 and F164 .... B1153, C1153, E1154 and F1153.

    Continue with the other summary rows.
    Attached Files Attached Files

  26. #26
    Forum Contributor
    Join Date
    02-11-2024
    Location
    Chicago
    MS-Off Ver
    2021
    Posts
    102

    Re: Average without Duplicate Values

    Thank you, sir. Works perfectly. I really appreciate your work on this.

  27. #27
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,422

    Re: Average without Duplicate Values

    Thanks for the rep.

  28. #28
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2504
    Posts
    13,740

    Re: Average without Duplicate Values

    You are welcome. Thank you for the feedback, added rep and marking your thread SOLVED.

  29. #29
    Forum Contributor
    Join Date
    02-11-2024
    Location
    Chicago
    MS-Off Ver
    2021
    Posts
    102

    Re: Average without Duplicate Values

    Sorry, but quick question. Can the A Column in your formula be locked with $A like so below?

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by IdabaMalouki; 04-14-2025 at 09:24 AM.

  30. #30
    Forum Contributor
    Join Date
    02-11-2024
    Location
    Chicago
    MS-Off Ver
    2021
    Posts
    102

    Re: Average without Duplicate Values

    Quote Originally Posted by FlameRetired View Post
    You are welcome. Thank you for the feedback, added rep and marking your thread SOLVED.
    Sorry, but quick question. Can the A Column in your formula be locked with $A like so below?

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  31. #31
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2504
    Posts
    13,740

    Re: Average without Duplicate Values

    Have you tried it?

  32. #32
    Forum Contributor
    Join Date
    02-11-2024
    Location
    Chicago
    MS-Off Ver
    2021
    Posts
    102

    Re: Average without Duplicate Values

    Yes. And it works

  33. #33
    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. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,920

    Re: Average without Duplicate Values

    If that takes care of your original question, please choose Thread Tools from the menu link above and mark this thread as SOLVED. You can also access the SOLVED tag by editing the opening post and choosing SOLVED from the drop-down to the left of the title box.

    Also, if you have not already done so, remember that you can reward 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.
    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.

+ 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 with multiple criteria and exclude duplicate values
    By chriswrcg in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 06-23-2023, 04:42 PM
  2. [SOLVED] Average and array formula not using duplicate values
    By kflemi16 in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 10-10-2022, 06:37 AM
  3. [SOLVED] Removing duplicate rows based on single column duplicate values
    By Miasav90 in forum Excel General
    Replies: 7
    Last Post: 09-23-2021, 08:40 AM
  4. Replies: 45
    Last Post: 01-04-2021, 09:03 AM
  5. [SOLVED] Average if values in adjacent columns is >0 AND adjust the average range each time
    By ew17 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-17-2020, 12:56 PM
  6. Replies: 4
    Last Post: 07-25-2017, 12:26 PM
  7. Replies: 1
    Last Post: 03-03-2014, 11:06 AM

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