Have Excel formulas that return 0, make the result blank

前端 未结 14 1930
别那么骄傲
别那么骄傲 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:53

    Just append an empty string to the end. It forces Excel to see it for what it is.

    For example:

    =IFERROR(1/1/INDEX(A,B,C) & "","")
    
    0 讨论(0)
  • 2020-12-31 09:55

    None of the above worked for me today, so I tried putting the 0 in quotes, as shown in the example below.

    Example: =IF(INDEX(a,b,c)="0","", INDEX(a,b,c))

    0 讨论(0)
  • 2020-12-31 09:56

    I figured it out, by concatenating an EMPTY string.

    INDEX(tt_Attributes,MATCH([RowID],tt_Attributes[RowID],0),COLUMN(tt_Attributes[Long Description]) ) & ""
    
    0 讨论(0)
  • 2020-12-31 09:57

    I am not sure it works with all type of data but the only solution I found for the moment is to test if index returns blank:

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

    The formula

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

    does not work with text

    0 讨论(0)
  • 2020-12-31 09:57

    If you’re willing to cause all zeroes in the worksheet to disappear, go into “Excel Options”, “Advanced” page, “Display options for this worksheet” section, and clear the “Show a zero in cells that have a zero value” checkbox.  (This is the navigation for Excel 2007; YMMV.)

    Regarding your answer (2), you can save a couple of keystrokes by typing 0;-0; –– as far as I can tell, that’s equivalent to 0;-0;;@.  Conversely, if you want to be a little more general, you can use the format General;-General;.  No, that doesn’t automagically handle dates, but, as Barry points out, if you’re expecting a date value, you can use a format like d-mmm-yyyy;;.

    0 讨论(0)
  • 2020-12-31 09:58

    There is a very simple answer to this messy problem--the SUBSTITUTE function. In your example above:

    =IF((1/1/INDEX(A,B,C))<>"",(1/1/INDEX(A,B,C)),"")
    

    Can be rewritten as follows:

    =SUBSTITUTE((1/1/INDEX(A,B,C), " ", "")
    
    0 讨论(0)
提交回复
热议问题