Results 1 to 28 of 28

NthMatch UDF as An Alternative to Array function...

Threaded View

  1. #21
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Cool Re: NthMatch UDF as An Alternative to Array function...

    Hi KVS Sir,
    There is a problem with your code (When I removed last 500 rows of data from reference),
    Pl have a look at Row 670 for explanation.

    I acknowledge the fact that you have the speed a lot by removing unnecessary steps in the code.
    So, I believe the Final version should be.
    Function NthMatch(ByVal Lvalue As Variant, Lrange As Variant, Mnum As Variant)
        Mstr = "|" & Join(Application.Transpose(Lrange), "|") & "|"
        Start = 1
        
        For c = 1 To Mnum
            Start = InStr(Start + 1, Mstr, Lvalue)
            If Start = 0 Then End '<--- This the line which I have included to leave loop.
        Next
        
        Temp = Left(Mstr, Start)
        NthMatch = Len(Temp) - Len(Replace(Temp, "|", "")) '<-- Calculating Row No.
    End Function
    Attached Files Attached Files

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