Results 1 to 4 of 4

VBA: MultipleLookupNoRept shows Repeats/Duplicates

Threaded View

  1. #1
    Registered User
    Join Date
    09-25-2018
    Location
    USA
    MS-Off Ver
    2017
    Posts
    8

    VBA: MultipleLookupNoRept shows Repeats/Duplicates

    Hello All,

    The following MultipleLookupNoRept VBA returns duplicates for some reason beyond me. What am I doing wrong? Any help would be appreciated.

    VBA:

    Function MultipleLookupNoRept(Lookupvalue As String, LookupRange As Range, ColumnNumber As Integer) As String
    
        Dim addresses As Variant, values As Variant
        Dim r As Long
    
        With LookupRange.Parent
            With Intersect(LookupRange.Columns(1), .UsedRange)
                values = .value
                addresses = .Columns(ColumnNumber).value
            End With
        End With
    
        With CreateObject("System.Collections.ArrayList")
            For r = 1 To UBound(values)
                If values(r, 1) = Lookupvalue And r <= UBound(addresses) And addresses(r, 1) <> "" Then
                    .Add addresses(r, 1)
                End If
            Next
    
            MultipleLookupNoRept = Join(.ToArray(), ", ")
        End With
    
    End Function

    Formula in Cell:

    ='Project Tracker and Analyser.xlsm'!MultipleLookupNoRept.MultipleLookupNoRept(M2,'PO Report'!C:L,5)

    Result:

    15461, 16461, 13461, 15461, 16461, 16461, 9129, 16461, 17530, 17500, 17561, 17530 <-------Shows Duplicates
    Last edited by Morey; 06-07-2019 at 05:20 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Function Arguments window shows result, cell shows a 0
    By fluffsmckenzie in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-09-2013, 05:48 PM
  2. Replies: 6
    Last Post: 12-09-2012, 09:00 PM
  3. [SOLVED] List Ascending Order shows duplicates
    By tomlancaster in forum Excel General
    Replies: 3
    Last Post: 04-05-2012, 06:10 PM
  4. Calculating Repeats not duplicates
    By dmatlof in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-19-2012, 09:19 PM
  5. Formulae for: 4 most repeats,4 least repeats in a series of numbers
    By Sedge in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-02-2010, 04:56 AM
  6. Replies: 3
    Last Post: 07-04-2008, 07:42 PM
  7. Need function for finding and indicating repeats/duplicates
    By CL39 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-20-2008, 01:30 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