Missing Values In Excel
Empty cells are treated as 0 when:
you do simple arithmetic, eg 9 – blank = 9
Empty cells are treated as missing when:
you do calculations using Excel statistical
functions, eg average(9,blank) = 9
you do graphs (this default option can be changed to graph blanks as zero
(Tools/Options/Chart/Plot empty cells as ..)
How to ensure you get the right answer when doing arithmetic on data that may
contain blanks:
If the arithmetic
involves just 1 cell
(eg =log(cell)), then
you can check the
contents of this cell
with the “If” function
and one of several choices of information functions which return a true of false result, eg
=if(isnumber(cell),log(cell),””)
The if function has the form
=if(condition, calculation if condition is true, calculation if condition is false).
Useful information functions are: isblank, isnumber, iserror (there are several others).
If the arithmetic involves several cells
(eg = A2/B2C2),
it is usually best to
check that all cells
have a value using
the count function.
Two double quotes (“”)
na()
displays a blank in the cell
displays #N/A in the cell
is treated as a blank cell in arithmetic and
statistical functions
results in an error in arithmetic and
statistical functions
Plots as zero on graphs for y variable
(unfortunately!)
And for x variable in a scatterplot, treats “”
as text and so x axis becomes observation
number
does not show on graphs
To get a missing value resulting from a formula to NOT display as 0 on graphs
You can replace “” in the “if” formula with na() eg =if(isnumber(cell),log(cell),na()).
Note that if you copy the calculated cells and paste as values, the cells that had the “”
result appear to be empty but still show on graphs as zeros!! You can find these cells by
selecting the range containing the calculated cells, choosing Edit/Goto/Special and
selecting Constants and Text then hitting the Delete key. (Let’s hope it is better in the
next version!)
Neil Cox, Statistics, AgResearch Ruakura
x =log(x) =if(isnumber(x),log(x)," ") =if(iserror(log(x)),"",log(x))
3 0.4771 0.4771 0.4771
5 0.6990 0.6990 0.6990
#NUM!
7 0.8451 0.8451 0.8451
9
9 =A1-A2
9 =average(A1:A2)
x y z =x/y-z =if(count (x,y,z)=3,x/y-z,"")
2 8 4 -3.75 -3.75
3 5 #DIV/0!
3 8 0.375