Have Excel formulas that return 0, make the result blank

前端 未结 14 1932
别那么骄傲
别那么骄傲 2020-12-31 09:45

A recurring Excel problem I have is formulas such as INDEX(array,row,column) that return 0 when there\'s no result, rather than returning blank.

What is

相关标签:
14条回答
  • 2020-12-31 09:58

    =IF(INDEX(a,b,c)="0","", INDEX(a,b,c)) worked for me with a minor modification. Excluding the 0 and no spaces in between quotations: =IF(INDEX(a,b,c)="","", INDEX(a,b,c))

    0 讨论(0)
  • 2020-12-31 10:00
    =if(b2 = "", "", b2)
    

    This worked for me

    0 讨论(0)
  • 2020-12-31 10:03

    Use conditional formatting (Home tab, styles section) and apply highlight cells rule (putting 0 in the Format cells that are equal to box) but select custom format then the Number tab. Select Category custom and in the type box put:

    0;-0;;@

    Sounds complicated but is actually simple.

    This gives the advantage that the cell looks empty but 0 is still the underlying value, so any formulas you use against that cell/selection will still see it as being numeric and saves on lots of messing around with chained IF statements.

    0 讨论(0)
  • 2020-12-31 10:03

    I noticed this issue recently and it is frustrating that excel changes a blank string into a 0. I do not think that a formula should solve this issue because adding more logic to a complex formula may be cumbersome and might even end up breaking the original formula. I have two non formula options below.

    If you want to keep the formulas in the cells and have them return 0 instead of "" use the following Click Path:

    1. File
    2. Options
    3. Advanced

    Scroll to "Display options for this worksheet:"

    1. Deselect "Show a zero in cells that have zero value"

    I also want to give a simple manual solution if you want to change a value (as opposed to a formula) from 0 to a blank string. This solution is better than Find and Replace because it will not replace a number like 101 with 11.

    1. Select all of your data
    2. On the data tab, click the filter logo

    1. Click on the pick list of the column with the undesired 0(s) to select only rows with the value "0" (Make sure to only clear the contents of cells containing contents with the exact value 0!)

    1. Select the data (which is only 0s), right click and select clear contents

    The other data will remain if you used the filter properly and the back button is always there if something goes wrong. I understand option 2 is very manual and "unelegant" but it does successfully convert a 0 into a blank string and it may relieve a frustrated individual who does not want to use an if statement.

    I personally learned something exploring this (very dry) excel issue today and I am personally using these methods moving forward. A quick macro of option 2 could be a good option if this is a frequent task for an intermediate excel user.

    0 讨论(0)
  • 2020-12-31 10:04

    The question may be why would you want it to act different from how it does right now? Apart from writing your own enveloping function or an alternative function in VBA (which will probably cause calculation speed reduction in large files) there might not be a single solution to your different problems.

    Any follow up formula's would most probably fail over a blank thus cause an error that you would capture with IFERROR() or prevent by IF(sourcecell<>"";...), if you would use the latter then testing for a zero is just the same amount of work and clutter. Checking for blank cells becomes checking for 0 valued cells. (if this doenst work for you please explain more specific what the problem is).

    For esthetic purposes the custom formatting solution would be just fine.

    For charts there might be an issue, which would be solved by applying it in the original formula indeed.

    0 讨论(0)
  • 2020-12-31 10:06

    The normal way would be the IF statement, though simpler than your example:

    =IF(INDEX(a,b,c),INDEX(a,b,c),"")
    

    No need to do gyrations with the formula, since zero values trigger the false condition.

    0 讨论(0)
提交回复
热议问题