+ Reply to Thread
Results 1 to 9 of 9

Thread: help with trapping error in IF function

  1. #1
    Registered User
    Join Date
    11-14-2008
    Location
    Saint Lucia
    Posts
    14

    Exclamation help with trapping error in IF function

    Hi All,

    I am trying to trap errors for the following formula in Excel 2003.

    =IF(EL39>0,(+EL39/EI39),0)

    Scenario:
    in EL39 value is 0.159 so first condition returns TRUE;
    in EI39 value is 0 so this part (+EL39/EI39) causes the #DIV/0!

    In 2007, i was able to solve it with the following:

    =IFERROR(IF(EL39>0,(+EL39/EI39),0),0)

    but i need the equivalent to this formula in 2003.

    Can anyone assist?

    Thanks!
    Last edited by Suety; 04-01-2010 at 10:47 AM.

  2. #2
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636

    Re: help with trapping error in IF function

    Try

    =IF(E139<=0,0,EL39/EI39)
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  3. #3
    Forum Guru darkyam's Avatar
    Join Date
    03-05-2008
    Location
    Colorado, US
    MS-Off Ver
    2007
    Posts
    2,170

    Re: help with trapping error in IF function

    Shouldn't it just be
    =IF(EI39=0,0,EL39/EI39), in case EI39 can be a negative number?

  4. #4
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636

    Re: help with trapping error in IF function

    I made assumption based on original OP formula...
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  5. #5
    Forum Guru darkyam's Avatar
    Join Date
    03-05-2008
    Location
    Colorado, US
    MS-Off Ver
    2007
    Posts
    2,170

    Re: help with trapping error in IF function

    That was with EL39, not EI39.

  6. #6
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636

    Re: help with trapping error in IF function

    True... let the OP decide.
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  7. #7
    Registered User
    Join Date
    11-14-2008
    Location
    Saint Lucia
    Posts
    14

    Re: help with trapping error in IF function

    Quote Originally Posted by NBVC View Post
    True... let the OP decide.
    Ok maybe i should explain the calculation:

    The formula is to calculate the average rate. EL39 is the Revenue and EI39 is the arrivals. So the general idea is:
    IF(EL37>0,(+EL37/EI37),0)
    if the revenue is more than 0, then divide the revenue by the arrivals. If it's not greater than 0 don't do the calculation and place 0 in the cell.

    in one scenario:
    EL39 is 0.159 and EI is 0

    based on the above explanation would the same suggestions apply?

  8. #8
    Forum Guru darkyam's Avatar
    Join Date
    03-05-2008
    Location
    Colorado, US
    MS-Off Ver
    2007
    Posts
    2,170

    Re: help with trapping error in IF function

    Since your data type seems to preclude the possibility of a negative number in EI, either way works. The < is unnecessary, but it won't hurt anything.

  9. #9
    Registered User
    Join Date
    11-14-2008
    Location
    Saint Lucia
    Posts
    14

    Re: help with trapping error in IF function

    Hi guys thanks for all the suggestions! I was able to get it working with the following formula:

    =IF(EL128>0,IF(ISERROR(+EL128/EI128),0,(+EL128/EI128)),0)

    Once again thanks!

+ 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.2.0