+ Reply to Thread
Results 1 to 4 of 4

Why advantage is there in using "if' statements

  1. #1
    Registered User
    Join Date
    09-12-2014
    Location
    Red Hook, Ny
    MS-Off Ver
    Version 2007 and 2010
    Posts
    6

    Why advantage is there in using "if' statements

    What is the advantage of using an if statement instead of just creating a formula?

    Example:

    Worksheet 1
    Cell A11 contains 150
    Cell A12 contains 100

    Cell A14 contains this formula =If(A11,(A11-A12)/A11,"") which returns .3333333 in cell A14

    Worksheet 2
    Cell B11 contains 150
    Cell B12 contains 100

    Cell B14 contains this formula =sum (B11-B12)/B11 which also returns .3333333 in Cell B14

    What is the advantage of using the "If" Statement over a regular formula?

    Thanks

    Rick

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,420

    Re: Why advantage is there in using "if' statements

    With the second one, you will get a divide by zero error (#DIv/0!) if B11 is blank. With the first one, you won't. You'll get a blank if A11 is blank or zero.

    Your choice: error or no error. That's the difference.


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,420

    Re: Why advantage is there in using "if' statements

    And you don't actually need SUM in the second example.

  4. #4
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,463

    Re: Why advantage is there in using "if' statements

    Try to delete A11, you can see the advantage.
    Quang PT

+ 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. Replies: 6
    Last Post: 03-07-2014, 10:34 PM
  2. Replies: 1
    Last Post: 01-15-2014, 08:53 AM
  3. 7 nested IF statements with a SEARCH added IF(ISNUMBER(SEARCH({"INSUR","AP REFUND"}
    By michaelproctor001 in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 12-10-2013, 02:13 PM
  4. Case Select statements with "if" statements
    By compulsiveguile in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-12-2008, 12:05 PM
  5. what is an advantage of using a model?
    By bekiwood in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-24-2005, 06:06 PM

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