+ Reply to Thread
Results 1 to 7 of 7

How to continue UDF after error and at last error should result in blank in case-no result

  1. #1
    Registered User
    Join Date
    03-17-2020
    Location
    India
    MS-Off Ver
    Office 365
    Posts
    4

    Smile How to continue UDF after error and at last error should result in blank in case-no result

    I created a UDF which is doing vlookup from two worksheets in same workbook and some values are not there, so UDF result in #Value error. now my idea is to adding 3rd worksheet for remaining values vlookup from there. and how can i end UDF result as blank instead of #Value error

    Please Login or Register  to view this content.
    now where above UDF not get values from Sheet"A" & Sheet"B", it should get values from Sheet"C".
    and still no values found from A,B,C then cell should result "". Blank only.
    please support

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: How to continue UDF after error and at last error should result in blank in case-no re

    Hi and welcome to the forum
    Please upload a workbook or a representative cut down copy, anonymised if necessary. It is always easier to advise if we can see your request in its context.

    Show a before and after situation with manually calculated results, explaining which information is data and which is results, and if it's not blindingly obvious how you have arrived at your results some explanatory notes as well.

    To upload a file click the Go Advanced button at the foot of your post, look underneath the post area for the Manage Attachments section and take it from there.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,636

    Re: How to continue UDF after error and at last error should result in blank in case-no re

    Replace all Application.WorksheetFunction.VLookup with Application.VLookup.

    Application.WorksheetFunction.VLookup raise the run-time error when nothing to return so, IsError function will not work.
    And also you can get rid of all Error handler.

  4. #4
    Registered User
    Join Date
    03-17-2020
    Location
    India
    MS-Off Ver
    Office 365
    Posts
    4

    Re: How to continue UDF after error and at last error should result in blank in case-no re

    jindon thanks for teach me this i have corrected in code in attached sample file from
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    Richard Buttrey : Here now i have attached a sample file, in this you will find sheets a,b and c have some data and sheet("data")
    is having calculations for column B which is doing vlookup and some cleaning and some more data requirement manipulation.
    myudf, i had prepared for two parameters : sheets"a" & sheets"b" but now i need to add third parameter in myudf.

    Thanks in advance
    Attached Files Attached Files

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,636

    Re: How to continue UDF after error and at last error should result in blank in case-no re

    1) Use in cell like
    G2:
    =IFERROR(MyLookUp(B2,A!$U$2:$AN$19,20,B!$U$2:$AZ$19,19,'C'!$B$2:$AZ$19,14),"")
    Where B2 = search value
    the rest are the parameter array, set of LookUp Range, reference column index and you can add more if you need to.

    2)
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    03-17-2020
    Location
    India
    MS-Off Ver
    Office 365
    Posts
    4

    Re: How to continue UDF after error and at last error should result in blank in case-no re

    this working perfectly, i just loved it! it is amazing , being lazy now i will look for less input that is
    1. How can i get rid of manual input of ranges from Sheets-A,B & C
    2. What is ParamArray
    3. Ubound
    4. CVErr
    Last edited by Tarun Verma; 03-20-2020 at 09:17 AM.

  7. #7
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,636

    Re: How to continue UDF after error and at last error should result in blank in case-no re


+ 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] #DIV/O! error - change to different result
    By nakwila in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-25-2019, 05:08 AM
  2. Formula not returning correct result. Formatting error or formula error?
    By Yonex1975 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-31-2019, 02:38 PM
  3. How to avoide error in result of 0/0
    By roofi in forum Excel General
    Replies: 3
    Last Post: 02-23-2016, 09:24 AM
  4. [SOLVED] Help with Formula using variable as Date and result as integer, error in my result
    By Elomaldo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-22-2014, 04:20 PM
  5. Replies: 2
    Last Post: 10-18-2013, 11:18 AM
  6. [SOLVED] Trying to Use ("") to Result in #VALUE Error Cells turning Blank
    By jordan1214 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 04-23-2013, 01:39 AM
  7. error in sum formula result
    By babygrand in forum Excel General
    Replies: 1
    Last Post: 06-08-2005, 03:05 PM

Tags for this Thread

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