Working with Excel Functions and Formulas
In this article on Excel Functions and Formulas :
This is intended to be a short guide to help you build and debug your own formulas.
First thing to know is that there is a major difference between excel functions and excel formulas:
Excel Functions are built into Excel and their functionality and arguments cannot be modified by users. An example of excel functions: SUM, COUNTIF, ROW, COLUMN, INDEX, MATCH, VLOOKUP, and so on.
An Excel Formula is designed by the user and it can contain multiple Excel Functions, Defined Names, Constants, Range references.
Excel Formulas can be very complex, but there are some limits:
Length of formula contents: 8,192 characters
Internal length of formula: 16,384 bytes
Worksheet arrays: Limited by available memory
Selected ranges: 2048
Arguments in a function: 255
Nested levels of functions: 64
Note: For more about Excel specifications and limits see: https://support.office.com/
When you start typing in a cell one of these 3 signs: the equal sign: “=”, the plus sign: “+”, or the minus sign: “-“, excel Function AutoComplete Intellisense is activated, any letters you type after will bring you the list of Excel Function that starts with that letter. If you continue to type more letters, the list will shrink to display only the ones that match to what you typed. (if you don’t want to see the list, you can always click the Escape key and continue, or just ignore it).
You can click once on any Function from the short list, Excel Intellisense will display a short description for that function (Tool Tips):
If you double click any function from list, Excel will insert the function in your formula, and automatically display the list of arguments for that function:
More on Formula AutoComplete on section 4: Display items using display triggers
Another good thing that might be useful to know is that both the function description and the list of function arguments rectangles are movable, you can drag them anywhere you want, just hover the mouse over the rectangle sides and the pointer will change to a quad arrow symbol; when you see the crossed arrows, just click and drag.
You can start writing a new formula by pressing the Insert Function button, from the Formulas Tab in Ribbon, or from the shortcut next to the Formula bar, as in the image below:
This action will open the Insert Function Wizard:
Insert Function Wizard
After you select a function and click ok, the Function Arguments window (see below image) will show up, with more useful information, like: argument data type, argument short description, formula result and a link to the Help section, with more details and examples for that function.
Again, Excel Intellisense will be very helpful, especially when you are dealing with a long and complex formula.Here is a video example:
To quickly identify which part of the formula failed, click after the first open paranthesis of the function to view the function arguments in tool tips, then click the logical argument link to select the entire argument, and click the F9 key to calculate only that argument. This action will replace the argument with its calculated value, you have to press Ctrl+Z to return to your formula or reference. For the example function, the steps to debug are :
1. Click in formula bar click after the first open paranthesis of the function;
2. Click the tooltips link to select the first argument (logical_test)
3. Press F9, the result should be TRUE or FALSE, Press Ctrl+Z to restore the argument. In this case, the result for this argument is TRUE.
4. We know from the previous step that the logical test returns TRUE, click now on the tooltip link to select the value_if_true argument. Pressing the F9 key will return an error for this argument, we have to evaluate all the functions used in this argument, to see which one returns an error. Remember to press CTRL+Z after each use of F9 key!
5. inside the value_if_true argument, we have another formula: IF(AND(B82>=12001,C82>2250),””Yes””,””No””)”
Repeat the above steps for each function used in this argument formula, select each argument one by one, press F9 to see its calculated value, then return with Ctrl+Z after each F9 key pressed.
For this example, the error is obvious, no debug is really needed, but with large data sets and multiple nested functions, it’s an easy way to understand what’s wrong there…
4. Formula AutoComplete: Display items using display triggers.
Remember that the AutoComplete feature will not be active if the first character in the cell is not one of the following:
– the equal sign: “=”
– the plus sign: “+”,
– or the minus sign: “-”
Display triggers for Excel Functions, Defined Names and Defined Table names:
– type one or more beginning letters, excel will display the items that starts with those letters, in alphabetical order.
For Function arguments, there are no display triggers!
Only a few Excel functions have arguments with enumerated constants that will be displayed automatically in list: CELL, FV, HLOOKUP, MATCH, PMT, PV, RANK, SUBTOTAL, VLOOKUP and AGGREGATE in newer versions of Excel.
Display triggers for Defined Tables special items: Headers, Totals, ThisRow, All, Data.
There are 3 display triggers for table components:
– the opening bracket: “[” , used after the table name: =Table1[
– the comma: “,” used after a table component: =Table1[[#All],
– or the colon sign: “:” (also known as the Range Operator), used after a column name: =Table1[[Column1]: