Results 1 to 28 of 28

NthMatch UDF as An Alternative to Array function...

Threaded View

Vikas_Gautam NthMatch UDF as An... 08-08-2014, 12:03 AM
Vikas_Gautam Re: NthMatch UDF as An... 08-08-2014, 11:30 PM
Vikas_Gautam Re: NthMatch UDF as An... 08-09-2014, 09:39 AM
MrShorty Re: NthMatch UDF as An... 08-09-2014, 10:37 AM
Vikas_Gautam Re: NthMatch UDF as An... 08-09-2014, 10:48 AM
kvsrinivasamurthy Re: NthMatch UDF as An... 08-10-2014, 11:22 AM
Vikas_Gautam Re: NthMatch UDF as An... 08-10-2014, 11:48 AM
kvsrinivasamurthy Re: NthMatch UDF as An... 08-11-2014, 12:16 AM
Vikas_Gautam Re: NthMatch UDF as An... 08-13-2014, 09:32 PM
kvsrinivasamurthy Re: NthMatch UDF as An... 08-15-2014, 03:51 AM
Vikas_Gautam Re: NthMatch UDF as An... 08-15-2014, 12:09 PM
Gregor y Re: NthMatch UDF as An... 10-17-2014, 10:17 PM
Vikas_Gautam Re: NthMatch UDF as An... 10-18-2014, 12:12 AM
Gregor y Re: NthMatch UDF as An... 10-18-2014, 03:36 AM
Vikas_Gautam Re: NthMatch UDF as An... 10-18-2014, 03:44 AM
Vikas_Gautam Re: NthMatch UDF as An... 01-07-2015, 08:35 AM
Vikas_Gautam Re: NthMatch UDF as An... 01-09-2015, 03:20 AM
kvsrinivasamurthy Re: NthMatch UDF as An... 01-10-2015, 08:52 AM
Vikas_Gautam Re: NthMatch UDF as An... 01-10-2015, 01:27 PM
kvsrinivasamurthy Re: NthMatch UDF as An... 01-11-2015, 08:48 AM
Vikas_Gautam Re: NthMatch UDF as An... 01-11-2015, 01:15 PM
Vikas_Gautam Re: NthMatch UDF as An... 01-11-2015, 01:25 PM
kvsrinivasamurthy Re: NthMatch UDF as An... 01-12-2015, 12:22 AM
Vikas_Gautam Re: NthMatch UDF as An... 01-12-2015, 12:33 PM
Vikas_Gautam Re: NthMatch UDF as An... 01-12-2015, 03:37 PM
kvsrinivasamurthy Re: NthMatch UDF as An... 01-12-2015, 11:05 PM
Vikas_Gautam Re: NthMatch UDF as An... 01-13-2015, 01:20 PM
kvsrinivasamurthy Re: NthMatch UDF as An... 01-13-2015, 11:47 PM
  1. #1
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Thumbs up NthMatch UDF as An Alternative to Array function...

    Hi Folks,
    Yesterday I posted following thread in this section ..
    http://www.excelforum.com/tips-and-t...ift-enter.html
    The thread was about using "Sumproduct as an alternative to array formulas.."
    I was very happy that I made something like this..

    but our Sir Mr. XOR opened my eyes and explain me why my formula was not that much fast as array function.. and was more intensive resource wise as well...

    Then I started think about another alternative..
    Actually I had, before posting the above thread, made an UDF ie NthMatch.. to return the Row No. of the Nth Match of a value in the array..
    It is an improvement over Match function.. as Match function only returns row No. of the first Match...

    when I got the solution.. what I saw that The NthMatch alternative was short(lenght wise) of the Sumproduct and Array alternatives..
    So that is what I wanted to share with you all..
    Have a visit at the link below.. and let me know whether there are any chances of improvement..
    http://excel-buzz.blogspot.in/2014/0...-to-array.html

    Here is the code for NthMatch(Lookup_value, Lookup_Range, Match No.)

    Function NthMatch(ByVal Lvalue As Variant, ByVal Lrange As Variant, Mnum As Variant) As Integer
    '*************Developed by Vikas Gautam ****************
    '*************www.Excel-buzz.blogspot.com***************
    Dim Arr()
    ReDim Arr(0)
    r = 0
    If IsArray(Lrange) Then
        For Each cell In Lrange
            c = c + 1 'c counts row no. to be checked
            If cell = Lvalue Then
                ReDim Preserve Arr(r)
                Arr(r) = c 'assigning row no. of the match row to the Arr
                r = r + 1
            End If
        Next
    Else
        If Lvalue = Lrange Then Arr(0) = 1 'if the Lrange is a single value ....
    End If
    NthMatch = Arr(Mnum - 1)
    End Function
    View post #9 for better solution given by KVS

    Regards,
    Vikas Gautam
    Attached Files Attached Files
    Last edited by Vikas_Gautam; 08-15-2014 at 12:41 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Alternative to using an array formula for {=LARGE(IF(... function
    By Rabiah in forum Excel Formulas & Functions
    Replies: 28
    Last Post: 05-30-2014, 05:52 AM
  2. UDF Lookup function as an alternative to array functions & match/index
    By Andrew_Harris in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-15-2012, 09:34 PM
  3. [SOLVED] Non array alternative for percentile function
    By vandan_tanna in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-22-2012, 11:43 AM
  4. Alternative to an array formula.
    By RunHard in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-16-2009, 09:18 AM
  5. Array Formula Alternative
    By smninos in forum Excel General
    Replies: 10
    Last Post: 07-15-2009, 04:31 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