+ Reply to Thread
Results 1 to 2 of 2

How to Use IsError input if IsError=false

Hybrid View

  1. #1
    Registered User
    Join Date
    10-14-2009
    Location
    Germany
    MS-Off Ver
    Excel 2003
    Posts
    1

    How to Use IsError input if IsError=false

    Hi, I'm trying to find a more efficient way to avoid errors.

    Right now I have:

    if(iserror(XYZ);"";XYZ)

    where XYZ is some long part of the formula. I do not want Excel calculating XYZ twice if there is no error...it almost takes a minute to calculate the entire workbook as is.

    Is there a formula I can use which will check if there is an error, return ABC if there is an error, otherwise return the input that was being checked for errors (i.e. formula above) all within the same cell?

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: How to Use IsError input if IsError=false

    Avoiding double evaluation pre XL2007 can be tricky...

    If the data type of XYZ is consistent - ie always number or always text for ex. then you can avoid using LOOKUP, eg

    Numbers
    =LOOKUP(9.99999999999999E+307;CHOOSE({1;2};0;XYZ))
    
    Text
    =LOOKUP(REPT("Z";255);CHOOSE({1;2};"";XYZ))
    (above open to error if XYZ exceeds char limits)
    If the above aren't viable then you're looking at using VBA to create a UDF to mimic the XL2007 IFERROR function, eg

    Public Function IFERR(vOne As Variant, vDefault As Variant) As Variant
    IFERR = IIF(IsError(vOne),vDefault,vOne)
    End Function
    The above, stored in a Module in VBEditor, is used from native XL along the lines of:

    =IFERR(XYZ;"")
    (you will find plenty of more advanced examples of the above UDF approach if you google etc...)

    In XL2007 MS finally added the long overdue IFERROR worksheet function

    =IFERROR(XYZ;"")

    Of course the other more basic approach is to calc XYZ in one cell and use another to output final result, eg

    A1: =XYZ
    B1: =IF(ISERROR(A1),"",A1)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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