# How to delete away the formula, if the cell is blank??

#### ru_1985

##### New Member
HI ALL.

How can i delete away the formula, when the is no value in it?
Or is there anyway to delete away e ZERO in the graph... so tat the line graph will not shown ZERO and it will left a blank...

Code:
``=IF(INDEX('AML101-ETCH'!B13:B47,MATCH('POLY ETCH CD DATA'!B17,'AML101-ETCH'!A13:A47,1))=0,"",INDEX('AML101-ETCH'!B13:B47,MATCH('POLY ETCH CD DATA'!B17,'AML101-ETCH'!A13:A47,1)))``

### Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

#### eliW

##### Well-known Member
Hi,

Try to replace the "" in your formula with NA()

This will be interpreted in the graph as "no data"

HTH

Eli

#### tusharm

##### MrExcel MVP
Re: How to get rid of the zero value in the line chart?

As has been pointed out, you need to use NA() instead of "". But, if you decide to use 2 cells instead of trying to squeeze everything into 1 cell, you can also improve the performance and maintainability of your workbook. In one cell, put the INDEX function. In the adjacent cell, put =IF({cell-with-index}=0,NA((),{cell-with-index}). Plot the 2nd cell (i.e., the one with the IF).

Now, you no longer duplicate the INDEX().

HI ALL.

How can i delete away the formula, when the is no value in it?
Or is there anyway to delete away e ZERO in the graph... so tat the line graph will not shown ZERO and it will left a blank...

Code:
``=IF(INDEX('AML101-ETCH'!B13:B47,MATCH('POLY ETCH CD DATA'!B17,'AML101-ETCH'!A13:A47,1))=0,"",INDEX('AML101-ETCH'!B13:B47,MATCH('POLY ETCH CD DATA'!B17,'AML101-ETCH'!A13:A47,1)))``

#### ru_1985

##### New Member
But i will like to delete away the formula, if the cell is blank...

#### Joe4

I think you may require a macro, something like this that will delete the formula:
Code:
``````Sub MyDeleteFormula()

Dim myRange As Range
Dim myCell As Range

'   Set range to check
Set myRange = Range("A1:A10")

'   Loop through each cell in range and delete contents if value is blank
For Each myCell In myRange
If myCell.Value = "" Or myCell.Value = 0 Then myCell.ClearContents
Next myCell

End Sub``````

#### ru_1985

##### New Member
ThanKS ALot thE cOdE work....

Replies
5
Views
147
Replies
9
Views
90
Replies
1
Views
419
Replies
1
Views
67
Replies
4
Views
67