Вы находитесь на странице: 1из 5

10 tips for troubleshooting Excel formulas and functions | Tech...

http://www.techrepublic.com/blog/10things/10-tips-for-trouble...

10 Things

By Susan Harkins March 1, 2012, 9:19 AM PST

Takeaway: Finding and fixing errors in formulas and functions can be tedious and time-consuming. Here are some practical tips to help you cut to the chase. Troubleshooting an Excel worksheets formulas and functions can be a big job. Errors just come with the package. Excel offers some valuable auditing tools, found on the Formulas tab in the Formula Auditing group, but you wont always need that much power. Sometimes, just a bit of special knowledge can help you resolve an error. These 10 tips will help even the most experienced Excel users find common errors quickly.

1: Error values are a clue, not a nuisance


If Excel cant calculate a formula, it displays an error value. These values are valuable clues and knowing what they mean can help you quickly spot errors. The following error values are your first step, and often the only step, to debugging an error: #DIV/0: Excel cant divide by 0 and your formula refers to a cell that contains or evaluates to 0 or is blank. This is one of the easiest to find and fix. #NAME?: This error occurs when you refer to a range incorrectly or forget to enclose text in quotation marks. When Excel encounters text in a formula, it tries to interpret the text as a cell reference, a range name, or a function name. When it cant recognize the text as any of those things, it displays this error value. Check your function names, cell references, and range names (make sure the range name actually exists if youve spelled it correctly). If all ranges are correct, make sure youve delimited text using quotation marks. #NULL!: You specified an intersection between two ranges that dont intersect, such as A1:C3 and D4:F6. If the ranges do intersect, youve probably used a space character (the union operator) instead of a comma to separate the two ranges (A1:C3 D4:F6 instead of A1:C3,D4:F6). #NUM!: This error value indicates a problem with a number in the formula. Either the argument is invalid or the result is too large or small. #REF!: Youve referenced a cell incorrectly. Most likely, youve deleted a cell. For instance, the expression =A1+B1 wont return an error if you delete the value in B1. But if you delete column B, it will. #VALUE!: Youve expressed the wrong data type or operator. The most common cause for this error value is a reference to text by a numeric operation.

2: Use error handling for #N/A


Excels #N/A error value isnt like the rest theres usually nothing wrong with the formula itself. It means that Excel cant return a result that makes sense. This error shows itself a lot with VLOOKUP() and HLOOKUP(). When one of these functions returns #N/A, it usually means it cant find the value youre looking for or that you havent sorted the list (which isnt always necessary). Fixing this error requires error handling. Specifically, in this case, youd wrap the original function in an error-handling routine that displays a meaningful message or more appropriate value. For instance, you might display the message, value not found the user understands that whereas the #N/A value might cause confusion.

1 of 5

06/03/2012 08:48

10 tips for troubleshooting Excel formulas and functions | Tech...

http://www.techrepublic.com/blog/10things/10-tips-for-trouble...

3: Evaluate components
One of the quickest ways to track down a problem is to evaluate individual components in the Formula bar or even right in the cell. Specifically, you highlight a cell reference or simple equation, press [F9], and Excel evaluates the highlighted expression and returns the result in the Formula bar. Either way, you can quickly pinpoint specific problems with logic. (To edit in-cell, simply double-click the cell. If that doesnt work, check the Advanced Editing Options.) Press [Esc] when youre done. Figure A shows a simple IF() function that returns the string is down if the yearly total for 2011 is less than 2010 well, its supposed to. When evaluating the expression in the Formula bar, as shown in Figure B, you can quickly see that the true and false actions dont match the conditional statements intent. This works, this time, because the expression follows the conditional logic: $44,075 is less than $45,962. But that wont always be the case. You can also use the Formula bar to learn a constants value and to discover errors caused by invalid data. Its not just for troubleshooting formulas.

Figure A

Shouldnt this expression return is down?

Figure B

Evaluating a portion of the formula in the Formula bar helps you pinpoint logic errors.

The Evaluate Formula option on the Formulas tab (in the Formula Auditing group) works similarly. Its a bit more methodical but certainly useful. In Excel 2003, youll find Evaluate Formula on the Tools menu under Auditing.

4: Check for multiple lines


Check the right end of the Formula bar if a formula looks too simple. Figure C shows a double arrow, which indicates that the formula comprises multiple lines. Click the down arrow to walk through the lines or click the Expand Formula Bar button (to the right) to display the full formula.

Figure C

2 of 5

06/03/2012 08:48

10 tips for troubleshooting Excel formulas and functions | Tech...

http://www.techrepublic.com/blog/10things/10-tips-for-trouble...

The down arrow to the right indicates that theres more to this formula.

To separate formula components, simply position the cursor where you want the formula to wrap to a new line and press [Alt]+Enter. Breaking an expression across lines can help you confine expression logic, where each line contains a step toward the resulting value. (Doing so often confuses users, though.)

5: Display formulas for easy checks


To quickly display all formulas, press [Ctrl]+~ (thats the tilde sign to the left of 1). Figure D shows a sheets formulas. Its a toggle, so pressing [Ctrl]+~ a second time will display results. Display formulas to check consistency and spot potential errors. Printing the formulas lets you continue your audit away from your computer. Most users already know how to do this, but you can use this tip to work more efficiently by using two windows, one with formulas, one with results, as shown in Figure E.

Figure D

Toggling between formulas and their results can help spot errors and inconsistencies.

Figure E

Display both formulas and their results to work more efficiently while troubleshooting.

You can also click Show Formulas in the Formula Auditing group on the Formulas tab to toggle between these two views. In Excel 2003, choose Options from the Tools menu. Then, click the View tab and check or uncheck the Formulas options in the Window Options section.

6: Select formula cells


Locating all the formulas in a complex sheet can be tedious work and youre apt to miss some if you rely on your memory or eyesight. Instead, let Excel do the work for you as follows: 1. Press [F5] to display the Go To dialog and click the Special button at the bottom. In Excel 2003, choose GoTo from the Edit menu and then choose Special. 2. In the resulting window, check the Formulas option, as shown in Figure F. 3. Click OK. Figure G shows the result in this case, a small range of formulas (B2:B4).

Figure F

3 of 5

06/03/2012 08:48

10 tips for troubleshooting Excel formulas and functions | Tech...

http://www.techrepublic.com/blog/10things/10-tips-for-trouble...

Check the Formulas option.

Figure G

Use the Special option to select cells that contain formulas.

If you need a more permanent solution, read Identify which cells in Excel are formula cells.

7: Its a date; no, its a number; no, its an error!


Sometimes, a formula returns a date or time value instead of the number you were expecting. This usually happens when a formula references a cell youve formatted as a date or time. In this case, theres nothing wrong with the formula; simply reformat the referenced cell correctly and the error value should disappear.

8: Check the number of characters


Older versions of Excel limit formulas to 1,024 characters; Excel 2007 has increased the maximum character limit to 8,192. Its doubtful that Ribbon users will ever hit that wall, but those still using the menu version might keep the 1,024-character limitation in mind. In addition, function nesting has increased from seven to 64 it boggles my mind. For more limits on Excel 2003 and Excel 2007/2010, read the following articles: Excel specifications and limits (2003) Excel specifications and limits (2010)

9: When your function returns the function


If you enter a function, press [Enter], and Excel displays the function, Excel is interpreting the cell contents as

4 of 5

06/03/2012 08:48

10 tips for troubleshooting Excel formulas and functions | Tech...

http://www.techrepublic.com/blog/10things/10-tips-for-trouble...

text. There are two possible fixes: If theres an apostrophe character at the beginning of the function, delete it. Make sure you havent formatted the cell as Text. If you did, change it to General or something more appropriate.

10: When your formula doesnt recalculate


You know the formula or function works it was fine until you changed one of the dependent values. When you did that, the function did not recalculate and show the updated result. The most likely reason is that youve turned off Excels automatic recalculation. Its easy to turn this option off while working and forget to turn it back on. Simply reset the calculation method to automatic as follows: 1. Select the File tab and click Options. In Excel 2007, click the Office button and click Excel Options. In Excel 2003, choose Options from the Tools menu. 2. Select Formulas in the left pane. In Excel 2003, click the Calculation tab. 3. In the Calculation sections, check the Automatic option. 4. Click OK.

Additional resources
Five tips for avoiding data entry errors in Excel Five tips for troubleshooting formulas in Excel The 10 most important things to teach your Excel users 10 Excel formatting decisions that can have unfortunate repercussions 10 mistakes to avoid when working with multiple worksheets 10 ways to screw up your spreadsheet design Five of my favorite Excel worksheet tips 10 ways to keep Excel from biting you in the butt Automatically sign up for TechRepublic's 10 Things newsletter!

5 of 5

06/03/2012 08:48

Вам также может понравиться