+ Reply to Thread
Results 1 to 6 of 6

Excel 2007 : If formula- help with the IF formula.

  1. #1
    Registered User
    Join Date
    05-23-2011
    Location
    Alabama
    MS-Off Ver
    Excel 2007
    Posts
    3

    If formula- help with the IF formula.

    Please help with the IF formula.

    Example: If A1-B1/A1 = 0

    I would like my answer is 0 instead of #DIV/0!

    Thank you in advance.

  2. #2
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    re: If formula- help with the IF formula.

    Welcome to the forum.

    Try:

    =IF(A1=0,0,A1-B1/A1)

  3. #3
    Registered User
    Join Date
    05-23-2011
    Location
    Alabama
    MS-Off Ver
    Excel 2007
    Posts
    3

    Smile re: If formula- help with the IF formula.

    Quote Originally Posted by Cutter View Post
    Welcome to the forum.

    Try:

    =IF(A1=0,0,A1-B1/A1)
    Cutter,

    Thank you for your help.

    One of my co-workers showed me a different formula but I think yours is easier for me to understand but just wanted to make sure you and I understand correctly before I switch to your formula

    Here it is:

    Column L51 (Billed)
    Column M51 (Cost)

    My formula is like this L51-M51/L51. This give me Profit % on REVENUE. But with this formula, it give me #DIV/0! instead of $0.

    Is this your IF formula to me? =IF(L51=0,0,L51-M51/L51)

    And Profit % on COST should be =IF(M51=0,0,L51-M51/M51), right?

    THANK YOU again for your help!!!!

  4. #4
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    re: If formula- help with the IF formula.

    The #DIV/0 error happens when there is a value being divided by 0 - which is not valid.
    So, to avoid a value being divided by 0 you first test to make sure that there won't be a 0.
    In your first example:
    =IF(L51=0,0,L51-M51/L51)
    you're testing to see if L51 is 0. If it is you'll get a 0 result instead of #DIV/0.
    If L51 is not 0 you'll get L51-M51/L51 but you should have (L51-M51)/L51 to make the L51-M51 calculate before that result is divided by L51. I would say that would be your Profit on Revenue and your Profit on Cost would be =(L51-M51)/M51 so, yes, you would have =IF(M51=0,0,(L51-M51)/M51)
    Last edited by Cutter; 05-23-2011 at 02:23 PM.

  5. #5
    Registered User
    Join Date
    05-23-2011
    Location
    Alabama
    MS-Off Ver
    Excel 2007
    Posts
    3

    re: If formula- help with the IF formula.

    Thanks Cutter,

    I saw my mistake before replied back to you so I put (L51-M51) in the bracket before devided by L51.

    Thanks again! You are so very nice to help me out!!!

    This site is very very helpful!!!

  6. #6
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    re: If formula- help with the IF formula.

    You're welcome - don't forget to mark your thread as SOLVED (click FAQ at top of page for instructions).

+ 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