+ Reply to Thread
Results 1 to 3 of 3

Grab unique values affiliated with a unique employee

  1. #1
    Registered User
    Join Date
    07-12-2010
    Location
    Denver
    MS-Off Ver
    Excel 2007
    Posts
    5

    Grab unique values affiliated with a unique employee

    Hi,

    I searched for a solution to my problem but couldn't find something workable. Here is what I have and what it is I'm trying to get as a result:
    A B C D E F
    ------------------ ----- --- --- --- ----
    Smith, Harry 700 0 0 0 0
    Smith, Harry 0 0 0 0 73510
    Smith, Harry 0 700 0 0 0
    Smith, Harry 0 0 800 0 0
    Smith, Harry 0 0 0 900 0
    Jackson, Tyrone 0 700 800 0 73510
    Jackson, Tyrone 700 0 900 0 73510

    I have a person's name in Column A and in columns B, C, D, E and F I have #s affiliated with that person.

    My results I want are:
    Smith, Harry 0, 700, 73510, 800, 900
    Jackson, Tyrone 0, 700, 800, 900 73510

    It condenses the five rows for Harry Smith down to one and condense Tyrone Jackson's two rows down to one because I only want unique names from Column A. "Smith, Harry" and "Jackson, Tyrone" may appear multiple times. Furthermore it shows me the associated unique #s for Harry Smith and Tyrone Jackson. As you may see for Harry Smith I want 700 to only show up one time even though 700 makes an appearance multiple times across multiple columns I want it displayed once.

    Any help is appreciated!
    Last edited by texaschili; 07-12-2010 at 06:32 PM.

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Grab unique values affiliated with a unique employee

    Viable approaches will all rather depend on volume of data.

    If for sake of demo. we assume:

    a) your data set is stored in Sheet1!A1:F7

    and

    b) your results are to be stored in Sheet2!A1:F2

    then

    Sheet2!B1

    =MIN(IF(((Sheet1!$A$1:$A$7=$A1)*(Sheet1!$B$1:$F$7))>(MAX($A1:A1)-ISTEXT(A1)),Sheet1!$B$1:$F$7))
    confirmed with CTRL + SHIFT + ENTER
    applied to matrix B1:F2

    NOTES:

    -- The above returns the numeric values in ascending order rather than in the order in which they appear (unclear if this is an issue or not)
    -- If you have fewer than five numbers 0's will result (these could be "hidden" via Conditional Formatting if nec.)

    If you have lots of data the above is not practical (IMO) and a VBA solution would make a great deal more sense.

  3. #3
    Registered User
    Join Date
    07-12-2010
    Location
    Denver
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Grab unique values affiliated with a unique employee

    I have 37,508 rows. Any thoughts on a VBA solution? Here is the VBA solution I tried:

    Sub DelCellContents()
    Do Until ActiveCell.Offset(0, 0) = 0
    Rng = Selection.Rows.Count
    ActiveCell.Offset(0, 0).Select
    Application.ScreenUpdating = False 'Sometimes when you run a macro, the screen flickers a lot due to the screen updating itself, thus slowing down the macro.
    For i = 1 To Rng
    If ActiveCell.Offset(0, 0) = ActiveCell.Offset(1, 0) And _
    ActiveCell.Offset(0, 1) = ActiveCell.Offset(1, 1) Then
    Selection.ActiveCell.Offset(0, 1).ClearContents
    Else
    ActiveCell.Offset(1, 0).Select
    End If
    Next i
    Application.ScreenUpdating = True 'Reset screen
    Loop
    End Sub

    I wanted it to go thru and delete cells with a zero leaving only valid #s.
    Last edited by texaschili; 07-13-2010 at 10:59 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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