Converting a #N/A error to a value: =ISNA
I had one dataset which I wanted to convert to a timeline. But the dataset did not include all dates - only those on which a particular event occurred.
So I had to fill in all the dates that were missing. That was pretty easy: type the first two, then select them and drag the + at the bottom right as far down as I needed (you can also double-click on it to copy it down to the last neighbouring value).
And I had to copy across all the values that matched the dates, which I did using the =VLOOKUP formula, also copied to the end.
But where there was no value to match, the VLOOKUP formula returned #N/A - and I needed it to say 0.
So I used =ISNA
=ISNA is a very simple formula: it checks if another cell is #N/A (IsNA - geddit?). If it is, it fills the cell containing the formula with TRUE. If it's not #N/A, it says FALSE.
Example: A2 says #N/A. If you type the formula =ISNA(A2) into cell A3 (or any other cell), and press enter, it will change to TRUE. If you then type a number or text into A2, then A3 will change to FALSE.
So far, so abstract. But why was this useful to me? Because I needed to convert all my #N/As into the number 0.
So, in column A I had dates, and in column B I had the number of events on that date - or #N/A where there were none. In cell C2, here's the formula I typed:
=ISNA(B2)
And copied down the entire column, so cell C3 said =ISNA(B3), and so on. Now I had a column full of cells that either said TRUE or FALSE.
Now I used an =IF formula to convert those to numbers.
In cell D2 I typed the following:
=IF(C2=TRUE, 0,B2)
Which did this: if cell C2 said TRUE (which meant that B2 said #N/A), then fill this cell with 0. If not, then fill it with the value in B2.
Once copied down the column, this now meant I had a column identical to column B, but with zeroes instead of #N/A.
There is probably a formula that would do both in one column, but there you go. ISNA explained.
PS: there are a whole series of =IS tests for other errors or types of content, including =ISERR for any error except for #N/A.