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
=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))
=if(b2 = "", "", b2)
This worked for me
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.
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:
Scroll to "Display options for this worksheet:"
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.
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.
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.
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.