+ Reply to Thread
Results 1 to 10 of 10

Combining IFERROR and IF formulas

Hybrid View

  1. #1
    Registered User
    Join Date
    07-11-2013
    Location
    Los Angeles, USA
    MS-Off Ver
    Excel 2007 & 2013
    Posts
    20

    Question Combining IFERROR and IF formulas

    I have one column A with Forecasted numbers, and column B with Actual numbers.

    I am trying to create an accuracy formula, which takes in consideration 0's.

    This is what I have:
    =IFERROR((A1/B1),"0%") I need to do an IFERROR, because some numbers in column A or B are "0's), and since we can't divide into 0's, the error will be replaced with 0% accurate.

    So if I forecasted 0, and sold 2, the above formula will throw "0%"
    If I forecasted 2 and sold 0, the above formula will also throw "0%".

    However, when columns A and B both contain 0's (I forecasted 0, and sold 0) I will get a "0%". In this case, forecasting 0 and selling 0, should be 100% accurate. So I wanted to incorporate:

    IF(A1=B1,"100%") into the IFERROR formula.. but I can't do it. Excel says that I have entered too many arguments,
    when I enter: =IFERROR((A1/B1),"0%",IF(A1=B1),"100%"))

    Any thoughts on how to combine these two? maybe I'm not combining them properly.

    Any help will be appreciated!
    (I'm using Excel 2007)

  2. #2
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Combining IFERROR and IF formulas

    Try

    =IF(B1=0,IF(A1=0,100%,0%),A1/B1)

  3. #3
    Registered User
    Join Date
    07-11-2013
    Location
    Los Angeles, USA
    MS-Off Ver
    Excel 2007 & 2013
    Posts
    20

    Re: Combining IFERROR and IF formulas

    Jonmo, I just tried the above formula, but it gives me a #DIV/0! error, when both numbers are 0

  4. #4
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Combining IFERROR and IF formulas

    That's not possible...
    Are you sure you put the formula exactly as I posted it?

    here's an example
    EFcesarmontoya.xlsx
    Last edited by Jonmo1; 07-29-2013 at 02:56 PM.

  5. #5
    Registered User
    Join Date
    07-11-2013
    Location
    Los Angeles, USA
    MS-Off Ver
    Excel 2007 & 2013
    Posts
    20

    Re: Combining IFERROR and IF formulas

    I see what you did. My column "B" (really in "J") numbers is being acquired by the following formula: =IFERROR(VLOOKUP(J10,A:H,8,FALSE),"0"). Where I forced a 0 in case it couldn't find the "part number" in the array. (my array for the vlookup does not necessary have all the part numbers).
    So in this case, a 0 shows up, but not as a number, therefore the DIV error. How do I change the whole column into an actual number? or, how do I incorporate that into the vlookup formula?

    Your formula worked, when I manually erased the "0" (derived from the vlookup) and manually typed the number "0".

  6. #6
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Combining IFERROR and IF formulas

    Just remove the quotes from that formula so that it returns a numeric 0, instead of a text 0
    =IFERROR(VLOOKUP(J10,A:H,8,FALSE),0)

  7. #7
    Registered User
    Join Date
    07-11-2013
    Location
    Los Angeles, USA
    MS-Off Ver
    Excel 2007 & 2013
    Posts
    20

    Re: Combining IFERROR and IF formulas

    Whoa! Perfect, thank you so much for your help and time.
    Now, I will try to decipher " =IF(B1=0,IF(A1=0,100%,0%),A1/B1) " and try to analyze what you did here- still a newbie at formulas/nesting.

    It would be cool to understand fully the logic, would you be able to break it down for me?

    Thank you!!!!

  8. #8
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Combining IFERROR and IF formulas

    If has 3 parts.

    1. Expression (a question with true or false answer)
    2. What to do If Expression is True
    3. What to do If Expression is False

    You can Nest another IF insede either part 2 or 3.

    So the Red Part is the "what to do if true" of the IF B1=0
    The Blue part is the "what to do if False" of the If B1=0
    =IF(B1=0,IF(A1=0,100%,0%),A1/B1)

    So if B1 DOES NOT = 0, then it goes straight to the A1/B1
    If B1 IS = 0, then it asks is A1=0, if true (this means A1 and B1 are both 0) then 100%, otherwise 0%

    Hope that helps.

  9. #9
    Registered User
    Join Date
    07-11-2013
    Location
    Los Angeles, USA
    MS-Off Ver
    Excel 2007 & 2013
    Posts
    20

    Re: Combining IFERROR and IF formulas

    Ah! I was confused because we were only looking at B1 first, and not if A1=0. But it makes sense, because you can't divide my 0, but you can have a 0 value and divide but something else.

  10. #10
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Combining IFERROR and IF formulas

    Right, only A1/0 causes DIV/0 error.
    0/B1 is NOT an error,

+ 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] Macro to add the IFERROR function to formulas
    By MadCrammer in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-14-2014, 12:41 PM
  2. 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
  3. Combining iferror, vlookup and min possible?
    By dominoes in forum Excel - New Users/Basics
    Replies: 6
    Last Post: 07-22-2012, 07:00 PM
  4. Help modifying macro to wrap iferror formulas around existing formulas
    By dcgrove in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-14-2012, 02:04 PM
  5. combining formulas
    By Sherri in forum Excel General
    Replies: 3
    Last Post: 07-19-2006, 05:35 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