Results 1 to 14 of 14

Excel Macro to find unique distinct value based on Criteria

Threaded View

amir_khan Excel Macro to find unique... 12-15-2014, 05:25 PM
davesexcel Re: Excel Macro to find... 12-16-2014, 02:22 AM
amir_khan Re: Excel Macro to find... 12-16-2014, 06:23 AM
davesexcel Re: Excel Macro to find... 12-20-2014, 04:43 PM
JBeaucaire Re: Excel Macro to find... 12-20-2014, 08:46 PM
davesexcel Re: Excel Macro to find... 12-20-2014, 08:55 PM
jindon Re: Excel Macro to find... 12-20-2014, 10:12 PM
amir_khan Re: Excel Macro to find... 12-23-2014, 09:28 AM
jindon Re: Excel Macro to find... 12-23-2014, 09:39 AM
amir_khan Re: Excel Macro to find... 12-27-2014, 08:24 AM
jindon Re: Excel Macro to find... 12-27-2014, 08:41 AM
amir_khan Re: Excel Macro to find... 12-28-2014, 09:45 AM
davesexcel Re: Excel Macro to find... 12-28-2014, 11:59 AM
amir_khan Re: Excel Macro to find... 12-31-2014, 06:47 PM
  1. #1
    Registered User
    Join Date
    12-31-2012
    Location
    Nairibi, kenya
    MS-Off Ver
    Excel 2010
    Posts
    6

    Excel Macro to find unique distinct value based on Criteria

    hi

    I am currently using following macro which I found from forum (thanks), however now I would like to collect information if column B value is equal to "Europe"

    Data  ,  Column B
    GER,     Europe
    IRQ,      Mideast
    JPN,      Fareast
    FRA,      Europe
    Answer should be in Dropdown list

    Please help me

    _____
    data column C

    Sub Select_ABC()
    '
    ' Select_ABC Macro
    ' Update Dorp Down list with ABC's in the Data Sheet
    '
    
    '
    ''
    
         Dim cbList
         Dim i As Long
         Dim j As Long
         Dim Temp As Variant
         
         Application.ScreenUpdating = False
         With Sheets("Data")
              cbList = Sheets("Data").Range("allTRANSlst") ', .Range("a" & Rows.Count).End(xlUp))
         End With
         Sheets("Summary").Activate
    With Sheets("Summary").ComboBox1
         .List = UNIQUE(cbList)
         For i = 0 To .ListCount - 2
            For j = i + 1 To .ListCount - 1
                If UCase(.List(i)) > UCase(.List(j)) Then
                    Temp = .List(j)
                    .List(j) = .List(i)
                    .List(i) = Temp
                End If
            Next j
        Next i
    End With
         Application.ScreenUpdating = True
    End Sub
    
    
    Function UNIQUE(v As Variant)
    Dim i
         With CreateObject("scripting.dictionary")
              .comparemode = 1
         For Each i In v
              If Not .exists(i) Then .Add i, Nothing
         Next
              If .Count > 0 Then UNIQUE = .keys
         End With
    End Function
    Last edited by JBeaucaire; 12-20-2014 at 08:42 PM. Reason: Added missing CODE tags. Please read and follow the Forum Rules, link above in the menu bar. Thanks.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Create a distinct list based on other criteria
    By tomtheappraiser in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-29-2014, 12:59 PM
  2. Replies: 5
    Last Post: 03-13-2012, 06:05 AM
  3. Pivot Tables-To Find Count of Unique(Distinct)User id within the same Journal Entry.
    By Deepthik in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-10-2010, 06:09 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