The effect of making an error in a spreadsheet can range from mildly irritating, through embarrassing, to the catastrophic and career threatening. For some examples of the latter, it’s worth looking through the collection of spreadsheet horror stories collated by the European Spreadsheet Risk Interest Group (EuSpRIG). Here, we are going to consider a few things that can go wrong rather too easily in a spreadsheet and see how to reduce the risk of them happening.
Sorting
We have typed a list of students and their exam scores into Excel. We want to sort the names alphabetically (Figure 1).
Sums sometimes sum some
This error is so common that Excel includes a specific check to highlight it. We can create a formula using the SUM() function to add up all our student scores (Figure 4).
In fact, if we recreate our SUM() formula, our range will use the name of our Table and column:
=SUM(Table2[Score])
One argument short of a lookup
The various Excel lookup functions are popular with those working with financial data where looking up a value in a table and returning the value from another column in that table is a common requirement. Here we want to see the score for the student whose name we enter in cell A2. We use the VLOOKUP() function to do so, entering A2 as the reference to our lookup value cell, and looking up our value in our Table that, as we saw in the previous example, we can refer to by name. Our third argument tells Excel to return the answer from column 2, the score column (Figure 7).
Unfortunately, Excel doesn’t return the value that we were probably expecting, returning the value from row 9 not row 11.
This is a result of our failure to specify the vital fourth argument of VLOOKUP(). This fourth argument determines whether the function will return an exact match or an approximate match. The default is to return an approximate match. In accidentally omitting the fourth argument, we condemn VLOOKUP() to performing an approximate match and thereby returning a seemingly random, incorrect answer. Here is our function with our fourth argument entered correctly (Figure 8).
There is a general approach to avoiding this sort of error and that is to be very careful and read the documentation on any Excel function you use that you are not already familiar with. The Insert Function button in the Excel formula bar will display an input screen that has a direct link to help on the function you are using.
Excel is also in the process of introducing a replacement for the existing lookup functions. The new XLOOKUP() function defaults to using an exact match.
Archive and Knowledge Base
This archive of Excel Community content from the ION platform will allow you to read the content of the articles but the functionality on the pages is limited. The ION search box, tags and navigation buttons on the archived pages will not work. Pages will load more slowly than a live website. You may be able to follow links to other articles but if this does not work, please return to the archive search. You can also search our Knowledge Base for access to all articles, new and archived, organised by topic.