+ Reply to Thread
Results 1 to 3 of 3

WorksheetFunction.IfError does not seem to work.

  1. #1
    Registered User
    Join Date
    04-15-2019
    Location
    Manila, Philippines
    MS-Off Ver
    2016
    Posts
    39

    WorksheetFunction.IfError does not seem to work.

    So I have this function:

    Please Login or Register  to view this content.
    xi and yi are a range of values taken from the sheet, x and y are input values. After calculating the array fi, some values may result to zero as intended. My problem appears when I'm trying to calculate fip. As seen there, it would be equal to the inverse of fi, and doing so would force a division by zero error on the zero values as calculated by fi. As seen there, and as a test, the division by zero happens at exactly row 6.

    What I needed to happen is that, should the division by zero occur, the operation would return a massive value for that particular row (say, fip would return 1000000). However upon running the code the output in the spreadsheet chucks out a #VALUE! error. What am I doing wrong?
    Last edited by ice00monster; 04-22-2019 at 03:20 PM. Reason: Solved

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,819

    Re: WorksheetFunction.IfError does not seem to work.

    The #Value error(s) returned reflect the VBA divide by 0 runtime error. I could be wrong, but I think what is happening here is that Excel's IFERROR() function is not programmed to trap VBA's errors. I think what you need to do is use a VBA based strategy (not using Excel's IFERROR() function) to trap the error. Since you know it will be a divide by 0 error, I would probably just use a simple If..then..Else type structure. Maybe:
    Please Login or Register  to view this content.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Registered User
    Join Date
    04-15-2019
    Location
    Manila, Philippines
    MS-Off Ver
    2016
    Posts
    39

    Re: WorksheetFunction.IfError does not seem to work.

    Thanks. Solved the problem with it.

+ 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] WorksheetFunction.SumIfs in vba doesn't work
    By mati_WAR in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-22-2017, 09:42 AM
  2. [SOLVED] IFERROR function doesn't seem to work
    By joel.mugabe in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-08-2016, 06:48 AM
  3. [SOLVED] Application.WorksheetFunction.Len doesnt work!
    By HerryMarkowitz in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-20-2015, 08:49 AM
  4. [SOLVED] WorksheetFunction.VLookup doesnt work if result is #N/A
    By HerryMarkowitz in forum Excel - New Users/Basics
    Replies: 9
    Last Post: 03-11-2015, 10:40 AM
  5. Application.worksheetfunction.Match doesn't work with Concatenated Ranges
    By Ricardo Gomes in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-25-2013, 07:19 AM
  6. xlfn.IFERROR or IFERROR don't work in Excel 98-2003
    By dj_danu01 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-26-2013, 02:53 AM
  7. Excel 2007 : IFERROR to work in 2003
    By Nikeyg in forum Excel General
    Replies: 4
    Last Post: 08-04-2010, 08:14 AM

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