+ Reply to Thread
Results 1 to 8 of 8

IF Statement syntax when cells are blank

  1. #1
    Forum Contributor
    Join Date
    02-22-2014
    Location
    Winthrop, ME
    MS-Off Ver
    Excel 2010
    Posts
    420

    IF Statement syntax when cells are blank

    Good evening. I'm using the following function to find the percentage of hours worked (F23) to hours authorized (E23). When E23 and F23 are filled in with numbers I get a percentage as expected in L23. When E23 is filled with a number and F23 is filled with a 0, L23 is left blank as expected. When E23 and F23 are both blank the result in L23 is #DIV/0!.

    I've tried unsuccessfully to adjust the following function (or would it be referred to as a formula) to return a "blank" value in L23 if E23 and F23 are blank.

    Please Login or Register  to view this content.
    Thanks for chiming in.

    Matthew

  2. #2
    Valued Forum Contributor Saarang84's Avatar
    Join Date
    02-19-2009
    Location
    Chennai, India
    MS-Off Ver
    XL 2003 to 2010
    Posts
    812

    Re: IF Statement syntax when cells are blank

    Use
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    You can even replace the "" with default result as 0 if you need
    If my assistance has helped, there is a reputation icon * on the left hand corner below the post - you can show your appreciation to the user who has helped in resolving your requirement.

    If your requirement has been solved please mark your thread as Solved.
    In the menu bar above the very first post, select Thread Tools, then select "Mark this thread as Solved".

    Kindly use [FORMULA] or [CODE] tags when posting your code.

    Regards,
    Sarang

  3. #3
    Forum Contributor
    Join Date
    02-22-2014
    Location
    Winthrop, ME
    MS-Off Ver
    Excel 2010
    Posts
    420

    Re: IF Statement syntax when cells are blank

    Sarang,

    Thank you very much. That did the trick.

    Matthew

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: IF Statement syntax when cells are blank

    Here's another one.

    =IFERROR(1/(1/(F23/E23)),"")
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  5. #5
    Forum Contributor
    Join Date
    02-22-2014
    Location
    Winthrop, ME
    MS-Off Ver
    Excel 2010
    Posts
    420

    Re: IF Statement syntax when cells are blank

    Quote Originally Posted by Tony Valko View Post
    Here's another one.

    =IFERROR(1/(1/(F23/E23)),"")
    Tony,

    That's really cool. I see that it works but I can't figure out (in English) how the heck the formula (or is it function) is doing what it's doing. Would you mind explaining? Thanks.

    Matthew

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: IF Statement syntax when cells are blank

    1 divided by 1 divided by any number will equal that number. For example:

    1/(1/22) = 22

    1/22 = 0.0454545454545455

    1/0.0454545454545455 = 22

    So, when F3/E3 is any number other than 0, the formula returns that number.

    When F3/E3 = 0 then 1/0 returns the #DIV/0! error.

    The IFERROR function traps the error and returns a blank instead.

  7. #7
    Forum Contributor
    Join Date
    02-22-2014
    Location
    Winthrop, ME
    MS-Off Ver
    Excel 2010
    Posts
    420

    Re: IF Statement syntax when cells are blank

    Quote Originally Posted by Tony Valko View Post
    1 divided by 1 divided by any number will equal that number. For example:

    1/(1/22) = 22

    1/22 = 0.0454545454545455

    1/0.0454545454545455 = 22

    So, when F3/E3 is any number other than 0, the formula returns that number.

    When F3/E3 = 0 then 1/0 returns the #DIV/0! error.

    The IFERROR function traps the error and returns a blank instead.
    Tony,

    Thanks for explaining the logic. Makes perfect sense. Great way to simplify an otherwise "wordy" formula.

    Matthew

  8. #8
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: IF Statement syntax when cells are blank

    You're welcome. Thanks for the feedback!

+ 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. IF Statement to leave cell blank if multiple cells are all blank
    By sweeteri in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 03-14-2014, 12:02 PM
  2. [SOLVED] If two cells are blank, if statement to show third statement is blank
    By juliewoo in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-20-2013, 12:28 PM
  3. Ignoring Blank Cells In IF Statement
    By BBar in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-12-2013, 03:31 PM
  4. DCOUNT-criteria syntax for counting blank cells
    By onin111 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-29-2008, 06:37 AM
  5. Replies: 3
    Last Post: 11-22-2007, 07:53 AM

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