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
You can create your own user defined functions in a module within Excel such as (from memory, so may need some debugging, and the syntax may vary among Excel versions as well):
Public Function ZeroToBlank (x As Integer) As String
If x = 0 then
ZeroToBlank = ""
Else
ZeroToBlank = CStr(x)
End If
End Function
You can then simply insert =ZeroToBlank (Index (a,b,c))
into your cell.
There's a nice tutorial on just this subject here.
The basic steps are:
Tools -> Macro -> Visual Basic Editor
.Insert -> Module
.=ZeroToBlank (<<whatever>>)
<<whatever>>
is the value you wish to use blank for if it's zero.Note that there may be minor variations depending on which version of Excel you have. My version of Excel is 2002 which admittedly is pretty old, but it still does everything I need of it.
Perhaps the easiest way is to add the text formatting condition to the formula, with a ?
modifier. Thus:
(formula to grab values)
becomes:
text((formula to grab values),"?")
Hope that helps.