Excel Tutorial: Basic Formula Writing, ROUND function, and VLOOKUP function In Microsoft Excel, Rename the SonnyCoffeeShop worksheet file as SonnyCoffeeShopUsername. Open. This table is used by Sonny’s Coffee Shop to calculate purchases of freshly ground coffee. The quantity of coffee is measured in pounds and the regular price is the cost per pound. Enter the data: Cell E7: Today, all coffees are discounted 33.33% (1/3 off) the original price. Calculate the amount of discount for the first coffee. Hint: the discount is 33.33% (cell E5) of the original price (D7). In mathematics, in the phrase “5% of something” the word “of” implies multiplication. When writing formulas, always use the cell address of a value instead of the numerical value. Use E5 instead of 33.33% in writing the formula. Notice that many of the cells have already been formatted to currency. Page 1 Wait, there is a problem. The spreadsheet shows the total as $4.58, but the product of 0.53 * $8.53 is $4.57. The answer is off by a penny ($0.01) Cells need to be formatted to display the values in a particular form, but sometimes the formatting covers over mistakes. Do not un-format your cells but look at the cells when the format of currency is removed. The first problem is the discount (cell E7), which is used in other formulas, is not to the nearest penny. Because of formatting the cell content may look like $4.32, but the value that is used in other formulas is 4.316667. We need the value to be exactly 4.32. =E5*D7 ROUND Function: To force the results of a calculation to a specified number of decimal places, you must use the ROUND(Value,DecimalPlaces) function. The value that needs to be rounded is E5*D7. The answer needs to be to the nearest penny, which is 2 decimal places. The formula becomes: Cell F7: Calculate the sale price of the coffee. The sale price is the regular price minus the discount. The sale price is $8.63 per pound of coffee. =D7-E7 Cell G7: Calculate the total price for the quantity of coffee purchased. The total price is the product of the quantity multiplied times the unit sale price. =C7*F7 Cell E7: =ROUND(E5*D7,2) Remember, whenever money is multiplied by a decimal or divided by any type of number, the answer must be rounded to the nearest penny. Instead of re-writing the formula, develop the skills to edit the original formula. In the cell content box, put the insertion point after the equal sign and type “round(“. Put the insertion point at the end of the equation and type “,2)” The unformatted values become: Excel Tutorial: Basic Formula Writing, ROUND function, and VLOOKUP function The sale price calculation does not need to be rounded, because this calculation involves subtracting two amounts of money that are to the nearest penny. Adding or subtracting amounts of money do not require rounding. Page 2 The problem is in the formula in cell E7. Only cell E5 contains the percent of discount. This cell address cannot change when copied down. Make E5 absolute, by adding the $ in the cell address, $E$5. Cell E7: =ROUND($E$5*D7,2) Notice that the Total price is not to the nearest penny. If several different coffees are purchased, this could create a problem. When adding amounts that are not to the nearest penny, the resulting total may not be correct. The calculation of the total price for a coffee must be rounded to the nearest penny (2 decimal places). Remember, whenever money is multiplied by a decimal number, the formula must be rounded to the nearest penny (2 decimal places). Edit the equation in cell E7. Put the insertion point where the $ signs should go and type $, or put the insertion point in the middle of the E5 and press the function key, F4. This function key is used to toggle through the 4 different addressing modes. Cell G7: =ROUND(C7*F7,2) Attempt to edit the formula rather than re-type it. Follow the previously defined steps to edit the formula. Add another coffee to the purchase. Copy the formulas on row 7 down to row 11. Select the 3 cells that contain a formula. Grab the handle in the lower right corner of the selection. Hold down the left mouse button. Drag down to row 11. Recopy the formulas down to row 11. The table should look like the following. Later in the course, you will learn how to “blank out” the $0.00 in this table. Oops!! There is a problem. Undo the copy. Excel Tutorial: Basic Formula Writing, ROUND function, and VLOOKUP function Cells G12:G14: Calculate the subtotal of all coffee purchases, a 6.50% (cell D13) state sales tax, and the total including tax. If you have questions about any of these formulas, the finished formulas are listed on the last page. Page 3 On the Number tab, select Custom. In the Type box enter 0.00 “lbs”. The following shows various common formats. • 0 whole number • #,##0 whole number with thousands separator • $#,##0 whole dollar currency • $#,##0.00 currency showing the penny position • 0.0 number showing 1 decimal place • 0.00 number showing 2 decimal places To add the phrase lbs, it must be inside quotes, “lbs”. Some letters define special formats, such as s for seconds. Spaces are placed outside the quotes. Custom Format: Include units on values that have units. For example, the first purchase item is 0.53 lbs of Dark Roast Coffee at $12.95/lb. Show the unit “lbs” on the quantity and “/lb” on the regular and sale price. Adjust column widths as needed. Select the 5 cells in the quantity column. Click on Format, Cell from the menu bar. Select the data in the Regular Price, Discount, and Sale Price columns. Click on Format, Cell from the menu bar. Excel Tutorial: Basic Formula Writing, ROUND function, and VLOOKUP function On the Number tab, select Custom. Enter the Type: $#,##0.00”/lb” Page 4 Click on Data, Validation from the menu bar. On the settings tab, enter the data validation definition for the quantity. The quantity must be a value between 0.01 (the smallest measurable weight on the scales that indicates some quantity of coffee) and 3.00 (the maximum weight that the scales can measure). You want to ignore the rule if the cell is blank. Adjust column widths if needed. The table should look like the following. DATA VALIDATION: When entering data into a worksheet, there are limitations or restrictions on the data. For example, in the blend table, you want only a name of a coffee that is actually being sold by the shop. The scales for measuring the weight of the coffee only goes up to 3.00 lbs. You cannot be allowed to enter a negative weight or a weight that is over 3 pounds. Data validation checks to make sure the inputted data meets these criteria. Data validation does not check for the accuracy. If you accidentally enter 2.83 lbs instead of 2.03 lbs, the value is not accurate, but it is an acceptable value. The user is not going to know the limitations set by this rule. For a numerical data validation, you must provide an Error Alert message. Click on OK Select the cells in the quantity column. Attempt to enter a negative value, zero, or a value above 3. Look at the error message. Excel Tutorial: Basic Formula Writing, ROUND function, and VLOOKUP function Cell/Range Name: The name of the coffee must be one of the coffees sold by Sonny’s Coffee Shop. Switch to the Tables sheet. Name the cells that make up the body of the table. Remember, the first cell is not blank, it contains a space, which only makes the cell appear to be blank. Later in the course, you will learn how to eliminate the need for this first row. Select the first table. Page 5 More Data Validation: Switch back to the BuyCoffee sheet. Select the cells in the Blend column. Click on Data, Validation from the menu bar. In the Name box at the top-left of the window, enter the name for this range of cells, Coffee. Remember to press <ENTER> after typing the name, otherwise the system will not accept the name. Select only the first column of the table. Name the range, Blend. On the settings tab, enter the data validation rule. The blend of coffee must be one of the coffees list in the range, Blend. To indicate that Blend is the range of the range instead of a value in the range, place an equal sign in front of the range name, such as =Blend. Because this creates a pull-down list, no error message is needed. Go to one of these cells, click on the button, and select a blend. Excel Tutorial: Basic Formula Writing, ROUND function, and VLOOKUP function Vertical Lookup Table: Delete the values in Column D, the Regular Price. Page 6 Formulas: Move to cell D7. Instead of entering the price of the coffee, we want to lookup the price in the Coffee table based on the selected blend of coffee shown in column B. Because of the data validation, the blend of coffee, must be a coffee found in the Coffee table or the cell will contain a space – making the cell appear blank. The price per pound is found in the second column of the Coffee table. Use the VLOOKUP(LookupValue,TableName,ColumnIndexNumber) function to lookup the price of each coffee. The LookupValue is the blend of coffee entered in column B (B7, B8, etc.). The TableName is Coffee. The ColumnIndexNumber is 2; the regular price per pound is found in the second column of the table. Cell D7: =VLOOKUP(B7,Coffee,2) Copy this formula down to row 11. When the name of the coffee is not entered, the regular price will show as $0.00/lb. If an error message appears rows 10 or 11, put a space in cells B10 and B11 – these cells cannot be empty. Later in the course, you will learn how to “blank out” these rows. Enter a third coffee. 1.25 lbs of Dark Chocolate coffee. Your table should look like the following: G12 =SUM(G7:G11) G13 =ROUND(D13*G12,2) (did you remember to round off. This calculation involves multiplying money times a decimal number.) G14 =SUM(G12:G13) =G12+G13 or
© Copyright 2026 Paperzz