+ Reply to Thread
Results 1 to 19 of 19

Turn formula cell to Blank if range in formula is empty

  1. #1
    Forum Contributor
    Join Date
    04-14-2014
    Location
    Philippines
    MS-Off Ver
    2007, 2010, 2013, 2016.
    Posts
    169

    Turn formula cell to Blank if range in formula is empty

    Hi All.
    D4 =SUM(D3+B4)-C4
    formula copy down to column D
    I could see the first computed result drag down.
    how do i make the result turn to blanks if the row to the formula don't have data?
    I've used IF function and "", the same result
    also how do i turn blank spaces (within the formula) into dashes (-)
    Thanks.
    Last edited by getafixkwik; 05-28-2016 at 02:07 AM.

  2. #2
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: Formula help

    Firstly you don't need the sum function. D3+B4-C4 is sufficient.

    To return blanks when there is no data the easiest way is to wrap an if formula. Depending on how your data is structured I'm assuming you will want to check the present line so maybe try this
    =if(B4="","",D3+B4-C4)

    Finally if you want to replace spaces with dashes a substitute formula will do this but I can't see how you'd have spaces in this formula as it looks like it is numerical not strings.
    Happy with my advice? Click on the * reputation button below

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,053

    Re: Formula help

    Pretty much everyone who logs on here wants formula help.

    Please take a moment to read the forum rules and then amend your thread title to something descriptive of your problem - not what you think the answer might be. (think google search terms?). Once you have done this please send me a PM and I will remove this request. (Also, include a link to your thread - copy from the address bar)

    Many members search our previous posts, and thread titles play a big part of the search. I doubt anybody would do a search based on your title?

    To change a Title on your post, click EDIT POST then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

    (note: this change is not optional )
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Forum Contributor
    Join Date
    04-14-2014
    Location
    Philippines
    MS-Off Ver
    2007, 2010, 2013, 2016.
    Posts
    169

    Re: Turn formula cell to Blank if range in formula is empty

    Hi Crooza,
    I have tried your suggestion. i got what i wanted, but when i input C, D cell continue to be empty and doesn't compute.
    i tried double IF argument, '=IF(B4="","",IF(C4="","")),D3+B4-C4, i got error #value error message
    what do you suggest?
    thanks for your help
    Last edited by getafixkwik; 05-28-2016 at 02:34 AM.

  5. #5
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: Turn formula cell to Blank if range in formula is empty

    Upload your file so I can see it. I'm flying blind without it.

  6. #6
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: Turn formula cell to Blank if range in formula is empty

    In the meantime the syntax of this

    IF(B4="","",IF(C4="","")),D3+B4-C4 is incorrect

    Maybe this will be better

    IF(B4="","",IF(C4="","",D3+B4-C4))

    Which could be simplified with an and statement too but first let's see if that fixes your problem. If not upload your file like I said above and we'll see if we can fix it.

  7. #7
    Valued Forum Contributor
    Join Date
    01-08-2011
    Location
    Portsmouth, England
    MS-Off Ver
    Excel 2007 to 2016
    Posts
    456

    Re: Turn formula cell to Blank if range in formula is empty

    The reason you get an error on the original formula is because "" is seen as text so can't be used in math calculations, resulting in an error

    Try this instead:

    =IF(B4=0,0,D3+B4-C4)

    If you want to check both B4 and C4 before calculating D4, you can use an AND statement in the IF formula, like this:

    =IF(AND(B4=0,C4=0),0,D3+B4-C4)

    You can replace the AND with OR if you want to check if either is true.
    Excel is a constant learning process and it's great to help each other. If any of us have helped you today, a click on the "reputation" star on the left is appreciated.

  8. #8
    Forum Contributor
    Join Date
    04-14-2014
    Location
    Philippines
    MS-Off Ver
    2007, 2010, 2013, 2016.
    Posts
    169

    Re: Turn formula cell to Blank if range in formula is empty

    Hi again.
    heres the file.
    Attached Files Attached Files

  9. #9
    Forum Contributor
    Join Date
    04-14-2014
    Location
    Philippines
    MS-Off Ver
    2007, 2010, 2013, 2016.
    Posts
    169

    Re: Turn formula cell to Blank if range in formula is empty

    Hi shirleyxls.
    thanks for the solution, but i still got 0 values if i copy the formula down.
    are there ways to turn 0 into blanks?
    Thanks
    Last edited by getafixkwik; 05-28-2016 at 03:11 AM.

  10. #10
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: Turn formula cell to Blank if range in formula is empty

    So did this work?

    =IF(B4="","",IF(C4="","",D3+B4-C4))

    You can simplify further by

    IF(and(B4="",C4=""),"",D3+B4-C4)

  11. #11
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: Turn formula cell to Blank if range in formula is empty

    So did this work?

    =IF(B4="","",IF(C4="","",D3+B4-C4))

    This will look for a blank in either cell. I think you want to find blanks in both cells so try this

    IF(and(B4="",C4=""),"",D3+B4-C4)

  12. #12
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2508 (Windows 11 Home 24H2 64-bit)
    Posts
    91,945

    Re: Turn formula cell to Blank if range in formula is empty

    There are no 0s in the attached file where the formula has been copied down.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  13. #13
    Valued Forum Contributor
    Join Date
    01-08-2011
    Location
    Portsmouth, England
    MS-Off Ver
    Excel 2007 to 2016
    Posts
    456

    Re: Turn formula cell to Blank if range in formula is empty

    To show zeros as blanks, go to:

    File > Options > Advanced

    Scroll down until you see Display Options for this worksheet, and uncheck the box for Show a zero in cells that have a zero value.

    Note that ALL zero values on this sheet will displayed as blanks.

  14. #14
    Forum Contributor
    Join Date
    04-14-2014
    Location
    Philippines
    MS-Off Ver
    2007, 2010, 2013, 2016.
    Posts
    169

    Re: Turn formula cell to Blank if range in formula is empty

    Crooza.
    IF(and(B4="",C4=""),"",D3+B4-C4) Works!
    Thank you!

  15. #15
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    31,321

    Re: Turn formula cell to Blank if range in formula is empty

    =IF(AND(B4=0,C4=0),0,D3+B4-C4)

    format cells (Custom format) as

    0.0;0.0;;@

  16. #16
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    31,321

    Re: Turn formula cell to Blank if range in formula is empty

    You will get value errors using Crooza's formula if you drag formula down

  17. #17
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: Turn formula cell to Blank if range in formula is empty

    Quote Originally Posted by getafixkwik View Post
    Crooza.
    IF(and(B4="",C4=""),"",D3+B4-C4) Works!
    Thank you!

    Great. Glad it worked

  18. #18
    Forum Contributor
    Join Date
    04-14-2014
    Location
    Philippines
    MS-Off Ver
    2007, 2010, 2013, 2016.
    Posts
    169

    Re: Turn formula cell to Blank if range in formula is empty

    Hi AliGW,
    I have not refresh this page when i uploaded the file. wasn't aware that there are other responses.
    anyway nice of you to drop by and look into my problem.
    Thanks.

  19. #19
    Forum Contributor
    Join Date
    04-14-2014
    Location
    Philippines
    MS-Off Ver
    2007, 2010, 2013, 2016.
    Posts
    169

    Re: Turn formula cell to Blank if range in formula is empty

    Hi JohnTopley,
    Nice to hear from you again. solution given by Crooza is correct until i notice that when i skip a few cells it will have #value error.
    but since i format those input cells into currency to get the dash i want, i just type 0 and the error went away.
    Your solution is also correct. Thanks.

+ 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: 11
    Last Post: 06-06-2014, 03:34 PM
  2. how to hide formula in formula box, view lookup result in formula box?
    By vengatvj in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-14-2013, 04: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