Hello everyone
I have this UDF (Narayan's from chandoo)
I intend to use that udf in a list of 200,000 rows ... How can I optimize that to make it faster?Please Login or Register to view this content.
Thanks a lot for advanced help
Hello everyone
I have this UDF (Narayan's from chandoo)
I intend to use that udf in a list of 200,000 rows ... How can I optimize that to make it faster?Please Login or Register to view this content.
Thanks a lot for advanced help
< ----- Please click the little star * next to add reputation if my post helps you
Visit Forum : From Here
Weirdly-built function. What are you trying to return? Currently it returns only the furthest-in first match of any of the items, so if there's multiple instances of the same code it may not return what you expect. Is this correct?
It also returns an 'illegal' Excel error code 0, meaning the error return triggers another error which then defaults to an error of #VALUE (actually code 2015, or xlErrValue). The error #N/A (code 2042 or xlErrNA) is more applicable to the string not being found, like when VLOOKUP cannot find a match.
Design everything to be as simple as possible, but no simpler.
Thanks a lot for reply
There's no problem. If not match found I could put empty string instead of CVErr(0)
The main problem is how to apply such idea on large amounts of data..
As for your question .. yes I would like to return only the furthest-in first match of any of the items
Running the UDF on 200,000 cells only took 2.2 secs for me. I was able to shave it down to 2.0 secs by declaring your array explicitly.
Code for testing with calculation method set to manual and autofilling formula each time (so that it must be calculated):Please Login or Register to view this content.
Please Login or Register to view this content.
If you do it purely in VBA you can get it down to 1.2 secs. Your decision if it's worth it *shrugs*
Please Login or Register to view this content.
Hi,
Why use a UDF at all? I suspect a formula would be faster. Perhaps
=IFERROR(MID(A1,AGGREGATE(14,6,FIND({"UY","OP","ST"},A1),1),2),"")
Don
Please remember to mark your thread 'Solved' when appropriate.
That is really awesome. Thank you very very much for this great solution
Best Regards
It is OK I have changed 2 at the end of the formula to 3 and it worked. Thanks a lot for great help
A modification to nitwit's clever formula for your purposes:
Formula:Please Login or Register to view this content.
Can confirm it returns the same result as UDF and VBA for these test strings:-
TARGET UDF FORMULA VBA this string contains nothing #N/A #N/A #N/A this string contains ST and UY UY UY UY this string contains ST and UY and ST UY UY UY this string contains ST and UY and ST and OP OP OP OP this string contains ST and UY and ST and OP and ST OP OP OP
If that takes care of your original question, please select Thread Tools from the menu link above to mark this thread as SOLVED.
To say thanks to the user(s) who contributed towards the solution, you can use the "Add Reputation" button on their helpful post(s).
Thanks!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks