+ Reply to Thread
Results 1 to 8 of 8

Filtering duplicate values with distinct scores

Hybrid View

  1. #1
    Registered User
    Join Date
    02-24-2014
    Location
    NOIDA
    MS-Off Ver
    Excel 2007
    Posts
    22

    Unhappy Filtering duplicate values with distinct scores

    I have an excel which is containing records of users who have given an online test.Many users have given the test multiple times. I need to extract the records of every indivdiual with the highest score. example it could be individual A, B and C have given the test 3 times with different scores achieved. I need the records of A, B and C in which their score was maximum.
    I hope I have clarified the problem I am in.
    Looking forward to quick response.
    Attached Files Attached Files
    Last edited by aashishni; 02-24-2014 at 09:58 AM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2505 Win 11
    Posts
    24,719

    Re: Filtering duplicate values with distinct scores

    Data Range
    A
    B
    C
    D
    E
    F
    G
    H
    1
    Name
    Score
    Max
    Sam
    Jim
    2
    Max
    100
    100
    99
    87
    3
    Sam
    98
    4
    Jim
    45
    5
    Max
    85
    Be sure to confirm with Ctrl + Shift + Enter
    6
    Sam
    99
    to get curly brackets
    7
    Jim
    55
    D2= {=MAX(IF($A$2:$A$8=D$1,$B$2:$B$8))}
    8
    Jim
    87
    Copy over
    9
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    02-24-2014
    Location
    NOIDA
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: Filtering duplicate values with distinct scores

    Thanks Alan,
    I think you have not completely understood the question, I will try and explain it again maybe I did not explain it clearly in the first instance. the columns that you see as empty in my attachement will all have values and I need the complete row of that person who has scored the maximum value, maybe in another worksheet in the same file. However, thanks for getting the discussion initiated .
    I hope i am making some sense !!!
    Last edited by aashishni; 02-24-2014 at 10:20 AM.

  4. #4
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,863

    Re: Filtering duplicate values with distinct scores

    1) if needed make a copy of the table (non-max duplicates will be permanently removed)
    2) select all table and sort on score in decreasing order
    3) with whole table selected Data->Remove Duplicates (unselect score from field list)
    4) if needed sort again in previous order (alphabetically or in employee nomber etc).
    Best Regards,

    Kaper

  5. #5
    Registered User
    Join Date
    02-24-2014
    Location
    NOIDA
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: Filtering duplicate values with distinct scores

    Sorry it gives me the message that "No Duplicates have been found"

  6. #6
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,863

    Re: Filtering duplicate values with distinct scores

    Have you done this: unselect score from field list
    and also any other fields which could be different for the same person like date etc.

  7. #7
    Registered User
    Join Date
    02-24-2014
    Location
    NOIDA
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: Filtering duplicate values with distinct scores

    Yep, I had missed that now I do get the values, anyway I can get those on a seperate sheet !!! Great Thank You !!!

  8. #8
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2505 Win 11
    Posts
    24,719

    Re: Filtering duplicate values with distinct scores

    Here is an alternative VBA solution.

    Option Explicit
    Sub HTH()
        Dim dMax As Double
        Dim lRow As Long
         
        With Sheet1 'Sheet CodeName
            dMax = WorksheetFunction.Max(.Columns(8))
             
            If dMax > 0 Then
                 'Use Find Method
                lRow = .Columns(8).Find(What:=dMax, After:=.Cells(1, 8), LookIn:=xlValues, LookAt:= _
                xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False).Row
                 
                 
                'MsgBox "Row number with " & dMax & " is: " & lRow
            End If
            Rows(lRow).EntireRow.Copy Sheets("Sheet2").Range("A2")
        End With
    End Sub
    How to install your new code
    1. Copy the Excel VBA code
    2. Select the workbook in which you want to store the Excel VBA code
    3. Press Alt+F11 to open the Visual Basic Editor
    4. Choose Insert > Module
    5. Edit > Paste the macro into the module that appeared
    6. Close the VBEditor
    7. Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)

    To run the Excel VBA code:
    1. Press Alt-F8 to open the macro list
    2. Select a macro in the list
    3. Click the Run button

+ 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. [SOLVED] formula to get the average scores per distinct names
    By albert28 in forum Excel General
    Replies: 2
    Last Post: 02-03-2014, 02:33 AM
  2. [SOLVED] Using SUMPRODUCT to sum duplicate scores with same criteria
    By JoeJaycee in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 04-17-2012, 06:27 PM
  3. Distinct values
    By kushibobby in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-24-2012, 09:15 AM
  4. Listzing distinct values
    By T De Villiers in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-26-2008, 02:46 PM
  5. Distinct Values
    By kittles3069 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-26-2007, 08:41 PM

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