+ Reply to Thread
Results 1 to 4 of 4

Ranking sales

Hybrid View

  1. #1
    Banned User!
    Join Date
    10-29-2012
    Location
    Europe
    MS-Off Ver
    2013, 2016
    Posts
    318

    Ranking sales

    Hello,

    I need some help. In column A (A2: A26) is Name 1 to Name 25. Column B (B2: B26) are numbers that can be doubled or tripled or more of the same kind. F1: J1, Place 1 to 5th place.
    I would like to put in order (F2: J2) decreasing numbers in column B, the name of the column A but if there are several names that have correspondent same number to be listed in the same cell separated by commas.

    See the attached file.
    Attached Files Attached Files
    Last edited by Indi_Ra; 01-20-2014 at 04:01 AM. Reason: Change title

  2. #2
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Reorder

    Try this:-
    Sub MG18Jan32
    Dim Rng         As Range
    Dim Dn          As Range
    Dim n           As Long
    Dim Dic         As Object
    Set Rng = Range(Range("b2"), Range("b" & Rows.Count).End(xlUp))
    Set Dic = CreateObject("scripting.dictionary")
    Dic.CompareMode = vbTextCompare
    
    For Each Dn In Rng
        If Not Dic.Exists(Dn.Value) Then
            Dic.Add Dn.Value, Dn.Offset(, -1)
        Else
            Dic.Item(Dn.Value) = Dic.Item(Dn.Value) & "," & Dn.Offset(, -1)
    End If
    Next
    
    For n = 1 To 5
        Cells(2, 5 + n) = Dic.Item(Application.Large(Dic.keys, n))
    Next n
    End Sub
    Regards Mick

  3. #3
    Banned User!
    Join Date
    10-29-2012
    Location
    Europe
    MS-Off Ver
    2013, 2016
    Posts
    318

    Re: Ranking sales

    MikeG,

    Code is excellent. Thanks a lot.
    Last edited by Indi_Ra; 01-20-2014 at 04:04 AM. Reason: Change title

  4. #4
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Reorder

    You're welcome
    Regrds Mick

+ 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. Reorder First Name and Last Name
    By hokieguy in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 05-07-2014, 08:51 PM
  2. reorder function
    By cb chiam in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 07:05 PM
  3. reorder function
    By cb chiam in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 PM
  4. reorder function
    By cb chiam in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 06:05 AM
  5. reorder function
    By cb chiam in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 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