+ Reply to Thread
Results 1 to 9 of 9

Match and average similar data

  1. #1
    Registered User
    Join Date
    07-09-2015
    Location
    UK
    MS-Off Ver
    2010
    Posts
    3

    Match and average similar data

    Hi

    I have a sheet with many, many items of data looking a number of products and various specifications associated with it. Amongst the specs there is test data for each product, i.e. the efficiency of each product - however in my data there are duplicates of a particular product, as in the test has been run multiple times but each time it gives a different efficiency value. Example Below

    Product Efficiency Match Average
    Red 32 1 32+33+35/3
    Red 33 1 [BLANK]
    Red 35 1 [BLANK]
    Blue 56 2 56+57/2
    Blue Stripes 63 3 63
    Blue 57 2 [BLANK]

    I wanted to average values if they matched names for examples (there's more criteria to be matched but if I get the gist of it, it should be easy enough to do), but I want the formula to run through the entire list, matching groups together and then averaging them based on other cell data. Ideally, I'd like to only have the average value in the first instance that product appears on the list, and leaving the rest blank.

    Not sure where to start with this.
    Last edited by P91; 07-09-2015 at 10:13 AM.

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    31,225

    Re: Match and average similar data

    Please post a sample file showing expected results.

  3. #3
    Forum Expert
    Join Date
    10-09-2012
    Location
    Dallas, Texas
    MS-Off Ver
    MO 2010 & 2013
    Posts
    3,049

    Re: Match and average similar data

    Without a sample file we can't help much, but an AverageIF formula would do just this.

    https://support.office.com/en-za/art...9-f5576d8ac642
    http://www.techonthenet.com/excel/fo.../averageif.php
    http://www.excelfunctions.net/Excel-...-Function.html
    Please ensure you mark your thread as Solved once it is. Click here to see how.
    If a post helps, please don't forget to add to our reputation by clicking the star icon in the bottom left-hand corner of a post.

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    31,225

    Re: Match and average similar data

    Data starting row 2

    =IF(COUNTIF($A$2:A2,A2)=1,AVERAGEIF($A$2:$A$7,A2,$B$2:$B$7),"")

  5. #5
    Registered User
    Join Date
    07-09-2015
    Location
    UK
    MS-Off Ver
    2010
    Posts
    3

    Re: Match and average similar data

    I've added an example sheet to try and explain it a bit better. So my 'match' criteria is if the product power, motor code, test type and system code are the same then they are grouped together and I have my data sorted like that. However, I can only average them together if the the type code is the same. The averageif only works if I enter the criteria though? I have about 100 groups in my data, and about 800 rows of data.


    example.xlsm

    JohnTopley - If I'm reading that correctly, it will only match for the first 'case' (red), and not average the blues together?

  6. #6
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    31,225

    Re: Match and average similar data

    Much more complicated as the selection needs to be across all criteria AND you have two columns with data to be averaged. Nothing like your example!

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    31,225

    Re: Match and average similar data

    The attached is an example but NOT complete. You need to test if data is in AH or AI and then add repeat of formula. You might also consider a helper column to concatenate the criteria columns but it is still messy.

    Results are in AW.
    Attached Files Attached Files

  8. #8
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    31,225

    Re: Match and average similar data

    A new version which uses a "helper" column in AY to group together items meeting the same criteria. The calculation (AZ) now uses this column to calculate the average. It also checks AH is blank: if so, uses AI.

    You can place the helper column anywhere BUT make sure you ensure the range references are correct: some are absolute, others are relative.

    If you move the helper column, place in row and then copy down as required. Ensure the cell above (row 3) is blank.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    07-09-2015
    Location
    UK
    MS-Off Ver
    2010
    Posts
    3

    Re: Match and average similar data

    Thanks John,

    That has worked quite well, I've found that there is some inconsistency in the naming inside my data which means that it's worked for most of the data, but there's a few that have thrown it off a little. Manually adjusting them sorted that though.

    Cheers again.

+ 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: 3
    Last Post: 05-18-2012, 08:11 AM
  2. vba to match multiple similar data question
    By lilsnoop in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 04-12-2012, 05:53 PM
  3. To match data of similar coding
    By avk in forum Excel General
    Replies: 5
    Last Post: 01-25-2010, 05:35 PM
  4. Match similar words to array and get row number of match
    By steefa in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-22-2009, 10:41 AM
  5. [SOLVED] MATCH function - 2 columns w/ SIMILAR, not EXACT data
    By Jane in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-05-2005, 12:06 AM

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