2.1 Formulas

Learning Objectives

  1. Learn how to create basic formulas.
  2. Understand relative referencing when copying and pasting formulas.
  3. Work with complex formulas by controlling the order of mathematical operations.
  4. Understand formula auditing tools.

This section reviews the fundamental skills for entering formulas into an Excel worksheet. The objective used for this chapter is the construction of a personal cash budget. Most financial advisors recommend that all households construct and maintain a personal budget to achieve and maintain strong financial health. Organizing and maintaining a personal budget is a skill you can practice at any point in your life. Whether you are managing your expenses during college or maintaining the finances of a family of four, a personal budget can be a vital tool when making financial decisions. Excel can make managing your money a fun and rewarding exercise.

Figure 2.1 "Completed Personal Cash Budget Workbook" shows the completed workbook that will be demonstrated in this chapter. Notice that this workbook contains four worksheets. The first worksheet, Budget Summary, contains formulas that utilize or reference the data in the other three worksheets. As a result, the Budget Summary worksheet serves as an overview of the data that was entered and calculated in the other three worksheets of the workbook.

Figure 2.1 Completed Personal Cash Budget Workbook

Creating a Basic Formula

Follow-along file: Excel Objective 2.00

Lesson Video: Basic Formulas

FormulasUsed to calculate a variety of mathematical outputs in Excel and can be used to create virtually any custom calculation required for your objective. are used to calculate a variety of mathematical outputs in Excel and can be used to create virtually any custom calculation required for your objective. Furthermore, when constructing a formula in Excel, you use cell locations that, when added to a formula, become cell referencesCell addresses used in formulas. Excel references the values entered into the cell locations used in formulas to produce outputs. When the values are changed in a cell referenced by a formula, Excel automatically produces new outputs. When a cell reference is used by itself in a cell location (cell address preceded by an equal sign [=]), Excel displays the value entered into that cell location.. This means that Excel uses, or references, the number entered into the cell location when calculating a mathematical output. As a result, when the numbers in the cell references are changed, Excel automatically produces a new output. This is what gives Excel the ability to create a variety of what-if scenarios, which will be explained later in the chapter.

To demonstrate the construction of a basic formula, we will begin working on the Budget Detail worksheet in the Personal Budget workbook, which is shown in Figure 2.2 "Budget Detail Worksheet". To complete this worksheet, we will add several formulas and functions. Table 2.1 "Spend Category Definitions" provides definitions for each of the spend categories listed in the range A3:A11. When you develop a personal budget, these categories are defined on the basis of how you spend your money. It is likely that every person could have different categories or define the same categories differently. Therefore, it is important to review the definitions in Table 2.1 "Spend Category Definitions" to understand how we are defining these categories before proceeding.

Figure 2.2 Budget Detail Worksheet

Table 2.1 Spend Category Definitions

Category Definition
Household Utilities Money spent on electricity, heat, and water and on cable, phone, and Internet access
Food Money spent on groceries, toiletries, and related items
Gasoline Money spent on fuel for automobiles
Clothes Money spent on clothes, shoes, and accessories
Insurance Money spent on homeowner’s or automobile insurance
Taxes Money spent on school and property taxes (this example of the personal budget assumes that we own property).
Entertainment Money spent on entertainment, including dining out, movie and theater tickets, parties, and so on
Vacation Money spent on vacations
Miscellaneous Includes any other spending categories, such as textbooks, software, journals, school or work supplies, and so on

The first formula that we will add to the Budget Detail worksheet will calculate the Monthly Spend values. The formula will be constructed so that it takes the values in the Annual Spend column and divides them by 12. This will show how much money will be spent per month for each of the categories listed in Column A. The following explains how this formula is created:

  1. Click the Budget Detail worksheet tab to open the worksheet.
  2. Click cell C3.
  3. Type an equal sign (=). When the first character entered into a cell location is an equal sign, it signals Excel to perform a calculation or produce a logical output.
  4. Type D3. This adds D3 to the formula, which is now a cell reference. Excel will use whatever value is entered into cell D3 to produce an output.
  5. Type the slash symbol (/). This is the symbol for division in Excel. As shown in Table 2.2 "Excel Mathematical Operators", the mathematical operators in Excel are slightly different from those found on a typical calculator.
  6. Type the number 12. This divides the value in cell D3 by 12. In this formula, a number, or constantNumerical value used in the construction of formulas. Constants should have some universal quality that does not change, such as days in a week or minutes in an hour., is used instead of a cell reference because it will not change. In other words, there will always be 12 months in a year.
  7. Press the ENTER key.

Table 2.2 Excel Mathematical Operators

Symbol Operation
+ Addition
Subtraction
/ Division
* Multiplication
^ Power/Exponent

Why?

Use Cell References

Cell references enable Excel to dynamically produce new outputs when one or more inputs in the referenced cells are changed. Cell references also allow you to trace how outputs are being calculated in a formula. As a result, you should never use a calculator to determine a mathematical output and type it into the cell location of a worksheet. Doing so eliminates Excel’s cell-referencing benefits as well as your ability to trace a formula to determine how outputs are being produced.

Figure 2.3 "Adding a Formula to a Worksheet" shows how the formula appears in cell C3 before you press the ENTER key. Figure 2.4 "Formula Output for Monthly Spend" shows the output of the formula after you press the ENTER key. The monthly spend for Household Utilities is $250 because the formula is taking the Annual Spend in cell D3 and dividing it by 12. If the value in cell D3 is changed, the formula automatically produces a new output. We are calculating the spend per month for each category because people often get paid and are billed for these items on a monthly basis. This formula allows you to compare your monthly income to your monthly bills to determine whether you have enough income to pay these expenses.

Figure 2.3 Adding a Formula to a Worksheet

Figure 2.4 Formula Output for Monthly Spend

Why?

Use Universal Constants

If you are using constants, or numerical values, in an Excel formula, they should be universal constants that do not change, such as the number of days in a week, weeks in a year, and so on. Do not type the values that exist in cell locations into an Excel formula. This will eliminate Excel’s cell-referencing benefits, which means if the value in the cell location you are using in a formula is changed, Excel will not be able to produce a new output.

Relative References (Copying and Pasting Formulas)

Follow-along file: Continue with Excel Objective 2.00. (Use file Excel Objective 2.01 if starting here.)

Lesson Video: Relative References

Once a formula is typed into a worksheet, it can be copied and pasted to other cell locations. For example, Figure 2.4 "Formula Output for Monthly Spend" shows the output of the formula that was entered into cell C3. However, this calculation needs to be performed for the rest of the cell locations in Column C. Since we used the D3 cell reference in the formula, Excel automatically adjusts that cell reference when the formula is copied and pasted into the rest of the cell locations in the column. This is called relative referencingExcel automatically adjusts a cell reference used in a formula or function relative to its original location when it is pasted into new cell locations. and is demonstrated as follows:

  1. Click cell C3.
  2. Click the Copy button in the Home tab of the Ribbon.
  3. Highlight the range C4:C11.
  4. Click the Paste button in the Home tab of the Ribbon.
  5. Double click cell C6. Notice that the cell reference in the formula is automatically changed to D6.
  6. Press the ENTER key.

Figure 2.5 "Relative Reference Example" shows the outputs added to the rest of the cell locations in the Monthly Spend column. For each row, the formula takes the value in the Annual Spend column and divides it by 12. You will also see that cell D6 has been double clicked to show the formula. Notice that Excel automatically changed the original cell reference of D3 to D6. This is the result of relative referencing, which means Excel automatically adjusts a cell reference relative to its original location when it is pasted into new cell locations. In this example, the formula was pasted into eight cell locations below the original cell location. As a result, Excel increased the row number of the original cell reference by a value of one for each row it was pasted into.

Figure 2.5 Relative Reference Example

Why?

Use Relative Referencing

Relative referencing is a convenient feature in Excel. When you use cell references in a formula, Excel automatically adjusts the cell references when the formula is pasted into new cell locations. If this feature were not available, you would have to manually retype the formula when you want the same calculation applied to other cell locations in a column or row.

Creating Complex Formulas (Controlling the Order of Operations)

Follow-along file: Continue with Excel Objective 2.00. (Use file Excel Objective 2.02 if starting here.)

Lesson Video: Complex Formulas

The next formula to be added to the Personal Budget workbook is the percent change over last year. This formula determines the difference between the values in the LY (Last Year) Spend column and shows the difference in terms of a percentage. This requires that the order of mathematical operations be controlled to get an accurate result. Table 2.3 "Standard Order of Mathematical Operations" shows the standard order of operations for a typical formula. To change the order of operations shown in the table, we use parentheses to process certain mathematical calculations first. This formula is added to the worksheet as follows:

  1. Click cell F3 in the Budget Detail worksheet.
  2. Type an equal sign (=).
  3. Type an open parenthesis (().
  4. Click cell D3. This will add a cell reference to cell D3 to the formula. When building formulas, you can click cell locations instead of typing them.
  5. Type a minus sign ().
  6. Click cell E3 to add this cell reference to the formula.
  7. Type a closing parenthesis ()).
  8. Type the slash (/) symbol for division.
  9. Click cell E3. This completes the formula that will calculate the percent change of last year’s actual spent dollars vs. this year’s budgeted spend dollars (see Figure 2.6 "Adding the Percent Change Formula").
  10. Press the ENTER key.
  11. Click cell F3 to activate it.
  12. Place the mouse pointer over the Auto Fill Handle.
  13. When the mouse pointer turns from a white block plus sign to a black plus sign, click and drag down to cell F11. This pastes the formula into the range F4:F11.

Table 2.3 Standard Order of Mathematical Operations

Symbol Order
^ First: Excel executes any exponential computations first.
* or / Second: Excel performs any multiplication or division computations second. When there are multiple instances of these computations in a formula, they are executed in order from left to right.
+ or − Third: Excel performs any addition or subtraction computations third. When there are multiple instances of these computations in a formula, they are executed in order from left to right.
( ) Override Standard Order: Any mathematical computations placed in parentheses are performed first and override the standard order of operations. If there are layers of parentheses used in a formula, Excel computes the innermost parentheses first and the outermost parentheses last.

Figure 2.6 "Adding the Percent Change Formula" shows the formula that was added to the Budget Detail worksheet to calculate the percent change in spending. The parentheses were added to this formula to control the order of operations. Any mathematical computations placed in parentheses are executed first before the standard order of mathematical operations (see Table 2.3 "Standard Order of Mathematical Operations"). In this case, if parentheses were not used, Excel would produce an erroneous result for this worksheet.

Figure 2.6 Adding the Percent Change Formula

Figure 2.7 "Removing the Parentheses from the Percent Change Formula" shows the result of the percent change formula if the parentheses are removed. The formula produces a result of a 299900% increase. Since there is no change between the LY spend and the budget Annual Spend, the result should be 0%. However, without the parentheses, Excel is following the standard order of operations. This means the value in cell E3 will be divided by E3 first (3,000/3,000), which is 1. Then, the value of 1 will be subtracted from the value in cell D3 (3,000−1), which is 2,999. Since cell F3 is formatted as a percentage, Excel expresses the output as an increase of 299900%.

Figure 2.7 Removing the Parentheses from the Percent Change Formula

Integrity Check

Does the Output of Your Formula Make Sense?

It is important to note that the accuracy of the output produced by a formula depends on how it is constructed. Therefore, always check the result of your formula to see whether it makes sense with data in your worksheet. As shown in Figure 2.7 "Removing the Parentheses from the Percent Change Formula", a poorly constructed formula can give you an inaccurate result. In other words, you can see that there is no change between the Annual Spend and LY Spend for Household Utilities. Therefore, the result of the formula should be 0%. However, since the parentheses were removed in this case, the formula is clearly producing an erroneous result.

Skill Refresher: Formulas

  1. Type an equal sign (=).
  2. Click or type a cell location. If using constants, type a number.
  3. Type a mathematical operator.
  4. Click or type a cell location. If using constants, type a number.
  5. Use parentheses where necessary to control the order of operations.
  6. Press the ENTER key.

Auditing Formulas

Follow-along file: Continue with Excel Objective 2.00. (Use file Excel Objective 2.03 if starting here.)

Lesson Video: Auditing Formulas

Excel provides a few tools that you can use to review the formulas entered into a worksheet. For example, instead of showing the outputs for the formulas used in a worksheet, you can have Excel show the formula as it was entered in the cell locations. This is demonstrated as follows:

  1. With the Budget Detail worksheet open, click the Formulas tab of the Ribbon.
  2. Click the Show Formulas button in the Formula Auditing group of commands. This displays the formulas in the worksheet instead of showing the mathematical outputs.
  3. Click the Show Formulas button again. The worksheet returns to showing the output of the formulas.

Figure 2.8 "Show Formulas Command" shows the Budget Detail worksheet after activating the Show Values command in the Formulas tab of the Ribbon. As shown in the figure, this command allows you to view and check all the formulas in a worksheet without having to click each cell individually. After activating this command, the column widths in your worksheet increase significantly. The column widths were adjusted for the worksheet shown in Figure 2.8 "Show Formulas Command" so all columns can be seen. The column widths return to their previous width when the Show Formulas command is deactivated.

Figure 2.8 Show Formulas Command

Skill Refresher: Show Formulas

  1. Click the Formulas tab on the Ribbon.
  2. Click the Show Formulas button in the Formula Auditing group of commands.
  3. Click the Show Formulas button again to show formula outputs.

Mouseless Commands

Show Formulas

  • Hold down the CTRL key while pressing the accent symbol (`).

Two other tools in the Formula Auditing group of commands are the Trace Precedents and Trace Dependents commands. These commands are used to trace the cell references used in a formula. The Trace Dependents command shows where any given cell is referenced in a formula. The Trace Precedents command shows what cells have been referenced in a formula that exists in an activated cell. The following is a demonstration of these commands:

  1. Click cell D3 in the Budget Detail worksheet.
  2. Click the Trace Dependents button in the Formula Auditing group of commands in the Formulas tab of the Ribbon. A double blue arrow appears, pointing to cell locations C3 and F3 (see Figure 2.9 "Trace Dependents Example"). This indicates that cell D3 is referenced in formulas that are entered in cells C3 and F3.
  3. Click the Remove Arrows command in the Formula Auditing group of commands in the Formulas tab of the Ribbon. This removes the Trace Dependents arrow.
  4. Click cell F3 in the Budget Detail worksheet.
  5. Click the Trace Precedents button in the Formula Auditing group of commands in the Formulas tab of the Ribbon. A blue arrow running through cells D3 and E3 and pointing to cell F3 appears (see Figure 2.10 "Trace Precedents Example"). This indicates that cells D3 and E3 are references in a formula entered in cell F3.
  6. Click the Remove Arrows command in the Formula Auditing group of commands in the Formulas tab of the Ribbon. This removes the Trace Precedents arrow.

Figure 2.9 "Trace Dependents Example" shows the Trace Dependents arrow on the Budget Detail worksheet. The blue dot represents the activated cell. The arrows indicate where the cell is referenced in formulas.

Figure 2.9 Trace Dependents Example

Figure 2.10 "Trace Precedents Example" shows the Trace Precedents arrow on the Budget Detail worksheet. The blue dots on this arrow indicate the cells that are referenced in the formula contained in the activated cell. The arrow is pointing to the activated cell location that contains the formula.

Figure 2.10 Trace Precedents Example

Skill Refresher: Trace Dependents

  1. Click a cell location that contains a number or formula.
  2. Click the Formulas tab on the Ribbon.
  3. Click the Trace Dependents button in the Formula Auditing group of commands.
  4. Use the arrow(s) to determine where the cell is referenced in formulas and functions.
  5. Click the Remove Arrows button to remove the arrows from the worksheet.

Skill Refresher: Trace Precedents

  1. Click a cell location that contains a formula or function.
  2. Click the Formulas tab on the Ribbon.
  3. Click the Trace Precedents button in the Formula Auditing group of commands.
  4. Use the dot(s) along the line to determine what cells are referenced in the formula or function.
  5. Click the Remove Arrows button to remove the line with the dots.

Key Takeaways

  • Mathematical computations are conducted through formulas and functions.
  • An equal sign (=) precedes all formulas and functions.
  • Formulas and functions must be created with cell references to conduct what-if scenarios where mathematical outputs are recalculated when one or more inputs are changed.
  • Mathematical operators on a typical calculator are different from those used in Excel. Table 2.2 "Excel Mathematical Operators" lists Excel mathematical operators.
  • When using numerical values in formulas and functions, only use universal constants that do not change, such as days in a week, months in a year, and so on.
  • Relative referencing automatically adjusts the cell references in formulas and functions when they are pasted into new locations on a worksheet. This eliminates the need to retype formulas and functions when they are needed in multiple rows or columns on a worksheet.
  • Parentheses must be used to control the order of operations when necessary for complex formulas.
  • Formula auditing tools such as Trace Dependents, Trace Precedents, and Show Formulas should be used to check the integrity of formulas that have been entered into a worksheet.

Exercises

  1. Which of the following terms best describes how Excel is able to change the outputs of formulas and functions when one or more inputs are changed?

    1. absolute references
    2. cell references
    3. relative references
    4. dynamic output referencing
  2. Which of the following best describes the proper use of numbers when constructing formulas in Excel?

    1. Numbers cannot be used in the construction of formulas. You can use only cell locations.
    2. You cannot combine numbers and cell locations in a formula. This will produce an error.
    3. Numbers should always be used when creating formulas in Excel.
    4. Numbers should be used when constructing formulas with constants that do not change, such as the days in a week, months in a year, and so on.
  3. Which of the following will be calculated first in the formula =((C10−D2)*A9)+B5*C5?

    1. D2*A9
    2. B5*C5
    3. C10−D2
    4. A9 * the result of (C10−D2)
  4. Which of the following formula auditing features would you use if you wanted to see where a specific cell location was referenced in formulas entered into a worksheet?

    1. Show Formulas
    2. Trace Precedents
    3. Trace Dependents
    4. Show Cell Reference Mapping