+ Reply to Thread
Results 1 to 6 of 6

Replace slow formula with macro or UDF

  1. #1
    Registered User
    Join Date
    02-22-2017
    Location
    Salem
    MS-Off Ver
    Windows 7
    Posts
    4

    Replace slow formula with macro or UDF

    i am having a list of values with multiples.... i want to list them with a macro... at present i am using this formula...it works nice but it takes much time to work. o kindly help me


    {=IF(ISERROR(INDEX($A:$C,SMALL(IF($B:$B=$F2,ROW($B:$B)),ROW($1:$1)),1)),"",INDEX($A:$C,SMALL(IF($B:$B=$F2,ROW($B:$B)),ROW($1:$1)),1))}
    Last edited by kishore013; 08-29-2017 at 10:25 PM. Reason: fixed title

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,962

    Re: I Need a Macro for this Formula [to list values with multiple occurrences]

    No, you just need a better formula - entered normally:

    =IFERROR(INDEX(A:A,MATCH(F2,B:B,FALSE)),"")

    Or you need to explain what you have and what you want, rather than just a formula....
    Last edited by Bernie Deitrick; 08-29-2017 at 05:05 PM.
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,598

    Re: I Need a Macro for this Formula [to list values with multiple occurrences]

    @6SJ: sounds as though there might be multiple matches and the OP wants to list them all, not just the first one. Only a guess, given the limited information.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Registered User
    Join Date
    02-22-2017
    Location
    Salem
    MS-Off Ver
    Windows 7
    Posts
    4

    Re: I Need a Macro for this Formula [to list values with multiple occurrences]

    yeah tms, you are right. i want to list multiple occurrences.

  5. #5
    Registered User
    Join Date
    02-22-2017
    Location
    Salem
    MS-Off Ver
    Windows 7
    Posts
    4

    Re: Replace slow formula with macro or UDF

    I have attached the sample excel. with this post like this i have more than 90k rows in my original excel. i want to find the multiple occurencces. so kindly help to reduce the calculation time either by macros or easier formulas.
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,962

    Re: Replace slow formula with macro or UDF

    The first problem that you have is that you are passing entire columns to your array formulas, which means that the formulas need to process 1 million+ cells for each call. And you are not using IFERROR, so the calls are doubled.

    In the attached, I changed the formulas to the exact range needed on the first sheet, and used IFERROR(formula,"") instead of IF(ISERROR(formula),"",formula) That is much much faster.

    Then on the second sheet, I sorted the data by column B first, then by column A - that changed the formulas needed from array formulas to a single MATCH function to find the first occurence, then simple indexing to get the rest of the data. Many times much faster.
    Attached Files Attached Files

+ 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. [SOLVED] Formula to count occurrences, multiple ranges, multiple criteria, with wildcard
    By TMMc in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-23-2017, 03:27 PM
  2. [SOLVED] lookup and list matches of a ref no with multiple occurrences
    By SKooLZ in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-04-2015, 04:46 PM
  3. Formula to find Top 3 occurrences in a list
    By janhillebrand in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-22-2014, 10:31 AM
  4. Replies: 19
    Last Post: 05-29-2014, 04:49 PM
  5. Replies: 3
    Last Post: 10-23-2013, 08:42 AM
  6. [SOLVED] In a single cell, count any occurrences from a list of values
    By daedelous00 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 07-05-2013, 03:30 PM
  7. [SOLVED] Counting Occurrences of Items in a List Based on Separate List Values
    By wheel1 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-10-2013, 01:04 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