COMM 205 2015W1 Lecture 04

20
COMM 205 Introduction to MIS Lecture 04: Microsoft Excel – Part III

description

Presentation for class.

Transcript of COMM 205 2015W1 Lecture 04

Page 1: COMM 205 2015W1 Lecture 04

COMM 205Introduction to MIS

Lecture 04: Microsoft Excel – Part III

Page 2: COMM 205 2015W1 Lecture 04

AGENDA

• I>Clicker questions

• Announcement: Class Liaison

• Today’s class: lecture and in-class exercise

• VLOOKUP function (both approximate and exact matches)

• In-class Exercise

COMM 205: Introduction to Management Information SystemsLecture 04: Microsoft Excel – Part III

Page 3: COMM 205 2015W1 Lecture 04

I>CLICKER DISCUSSION POLICY

• You may not

• use a calculator, laptop computer, cellphone or smart phone, or any other electronic devices, EXCEPT your own i>Clicker remote.

• consult your notes, PowerPoint slides, or the assigned readings during an i>Clicker session.

• You may, however, use a pencil/pen and a blank sheet of paper to do any of the i>Clicker questions.

• You must still, however, submit your own response using your own i>Clicker remote.

COMM 205: Introduction to Management Information SystemsLecture 04: Microsoft Excel – Part III

Page 4: COMM 205 2015W1 Lecture 04

I>CLICKER QUESTION 1

• Which of the following scenarios was used to illustrate the use of COUNTIFS/SUMIFS in the previous lecture (that is, lecture 03)?

• (A) Airports in the New York Metropolitan Area

• (B) Airports in Eastern Canada

• (C) Credit/D/Fail grading scheme at UBC

• (D) Credit/D/Fail grading scheme at SFU

• (E) What to bring (sunglasses or none) depending on the weather forecast

COMM 205: Introduction to Management Information SystemsLecture 04: Microsoft Excel – Part III

Page 5: COMM 205 2015W1 Lecture 04

I>CLICKER QUESTION 2

• Suppose that in an Excel worksheet, cell A1 contains the text ABC. In the same worksheet, cell B1 contains the formula =IF(A1="abc",1,0). When the formula is executed, the value returned in cell B1 will be:

• (A) 1

• (B) 0, because of the different case (ABC is in uppercase, while abc is in lowercase)

• (C) 0, because the text ABC in cell A1 does not have quotation marks surrounding the text

• (D) abc

• (E) none of the above

COMM 205: Introduction to Management Information SystemsLecture 04: Microsoft Excel – Part III

Page 6: COMM 205 2015W1 Lecture 04

I>CLICKER QUESTION 3

COMM 205: Introduction to Management Information SystemsLecture 04: Microsoft Excel – Part III

• Mamasita Restaurant sells five types of dish, each of which is either Main or Dessert. The following table lists the number of portions of each dish made and sold yesterday.

• Suppose the cell E1 contains the formula

=COUNTIFS(C3:C7,"Main")-COUNTIFS(D3:D7,"Dessert")

• When the formula is executed, the value returned in cell E1 will be:

• (A) 110 (B) 70 (C) 1 (D) 0

• (E) none of the above

Page 7: COMM 205 2015W1 Lecture 04

I>CLICKER QUESTION 4

COMM 205: Introduction to Management Information SystemsLecture 04: Microsoft Excel – Part III

• Consider the same Mamasita Restaurant scenario:

• Suppose the cell E2 contains the formula

=SUMIFS(C3:C7,B3:B7,"Main",D3:D7,"_________")

• When the formula is executed, the value returned in cell E2 is 40. A possible value that fits the _________ in the above formula that will produce such result is:

• (A) Laing (B) Adobo (C) 50 (D) 40(E) 35

Page 8: COMM 205 2015W1 Lecture 04

VLOOKUP FUNCTION BASICS

• The VLOOKUP function looks up a value in the first column of a range of cells, and then returns a value from any cell on the same row of the range.

• VLOOKUP can be used to find:

• exact matches, or• The nearest value that is less than or equal to the search value. For

example, you can use VLOOKUP to assign a grade of B+ for students who receive a grade from 76 to 79.

COMM 205: Introduction to Management Information SystemsLecture 04: Microsoft Excel – Part III

Page 9: COMM 205 2015W1 Lecture 04

VLOOKUP FUNCTION – EXACT VS. APPROXIMATE MATCHES

Exact Matches

• If the VLOOKUP is used to find an exact match, the rows can be in any order.

• VLOOKUP starts with the first value in the first column, and works its way down until it finds a match.

• Therefore, to avoid mistakes, make sure that each value in the first column is unique. That is, that there are no duplicates in the first column.

Approximate Matches

• If you want to look up a value in a range (e.g. 76 to 79), you MUST arrange the lookup table so that the data are sorted from the lowest to the highest.

• You MUST only include the lowest value in the range (in this case, 76). It is called the breakpoint.

• Do NOT use the complete range in Column 1 (i.e. NOT 76 – 79).

COMM 205: Introduction to Management Information SystemsLecture 04: Microsoft Excel – Part III

Page 10: COMM 205 2015W1 Lecture 04

Range Grade

90 – 100 A+

85 – 89 A

80 – 84 A–

76 – 79 B+

72 – 75 B

68 – 71 B–

64 – 67 C+

60 – 63 C

55 – 59 C–

50 – 54 D

0 – 49 F

Range Grade

0 F

50 D

55 C–

60 C

64 C+

68 B–

72 B

76 B+

80 A–

85 A

90 A+

VLOOKUP FUNCTION FOR APPROXIMATE MATCHES

Figure 1

INCORRECT lookup table CORRECT lookup table

COMM 205: Introduction to Management Information SystemsLecture 04: Microsoft Excel – Part III

Page 11: COMM 205 2015W1 Lecture 04

VLOOKUP FUNCTION SYNTAX=VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])

COMM 205: Introduction to Management Information SystemsLecture 04: Microsoft Excel – Part III

Argument Description

lookup_value Cell reference (i.e. the address of the cell) that contains the value to look up.

table_array Range of the lookup table.

col_index_num The column number that contains the result/return values in the lookup table.

[range_lookup]*

*Optional—only required if you want to find an exact match.

By default, this is set to TRUE (i.e. you don’t have to type TRUE—this can be omitted). TRUE means Excel will look up the closest match (approximate match). If you want to Excel to find an exact match, set this to FALSE (i.e. you MUST type FALSE).

Figure 2 (Adapted from Poatsy, Mary, et al. 185 – 186)

Page 12: COMM 205 2015W1 Lecture 04

VLOOKUP FUNCTION: APPROXIMATE MATCHES

COMM 205: Introduction to Management Information SystemsLecture 04: Microsoft Excel – Part III

Figure 3

Page 13: COMM 205 2015W1 Lecture 04

VLOOKUP FUNCTION: APPROXIMATE MATCHES

• In cell E3, start by typing =VLOOKUP(

• We want to award the letter grade based on the numerical score in column D, so the lookup_value will Score. In this case, it is D3.

• The table_array will be the lookup table, which is G4:H14. It is a good idea to make this table array an absolute reference $G$4:$H$14 because we will need to copy and paste the formula. However, VLOOKUP will work even if it is left as G4:H14.

• We want Excel to return the letter grade from the lookup table. The letter grade is in the second column of the lookup table, so the col_index_num is 2.

• We don’t need to enter the [range_lookup] argument as we are not finding an exact match. If you, however, still want to include a [range_lookup], then type TRUE.

• Don’t forget to type the closing bracket, and your formula should look like this: =VLOOKUP(D3,$G$4:$H$14,2)

COMM 205: Introduction to Management Information SystemsLecture 04: Microsoft Excel – Part III

Page 14: COMM 205 2015W1 Lecture 04

VLOOKUP FUNCTION: APPROXIMATE MATCHES

• Drag the formula down to fill the rest of column E until you reach cell E10. Then, compare your results with Figure 4 below.

Figure 4

COMM 205: Introduction to Management Information SystemsLecture 04: Microsoft Excel – Part III

Page 15: COMM 205 2015W1 Lecture 04

VLOOKUP FUNCTION: EXACT MATCHES

• Now we turn to an example of the VLOOKUP function when we want to find exact matches.

COMM 205: Introduction to Management Information SystemsLecture 04: Microsoft Excel – Part III

Figure 5

Page 16: COMM 205 2015W1 Lecture 04

VLOOKUP FUNCTION: EXACT MATCHES

• The VLOOKUP function can automate the process of entering Product Description, Unit Price, and Order Amount each time.

• This way, every time a customer orders, all we need to do is fill in the Product Code and Quantity. The Product Description and Unit Price can be filled in through the use of a VLOOKUP function. The Order Amount can be filled in by a multiplication function.

• The VLOOKUP functions that we are going to use in this scenario is different from the approximate match example. Here, we need to find exact matches.

• We will need to ensure that Excel only returns a value for Product Description and Unit Price only if the Product Code is listed in the Product List.

COMM 205: Introduction to Management Information SystemsLecture 04: Microsoft Excel – Part III

Page 17: COMM 205 2015W1 Lecture 04

VLOOKUP FUNCTION: EXACT MATCHES• Thankfully, the only difference between a VLOOKUP function that searches for an

approximate match and the one searching for an exact match is in the [range_lookup].

• Recall the syntax:

=VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])

• To find exact matches, [range_lookup] has to be set to FALSE.

• Now begin by clicking on cell B19.

• For lookup_value, you want to look up cell A19 since we want to match the Product Code in the Phone Order Form with the Product Code in the Product List. Begin by typing =VLOOKUP(A19,

• The lookup table for this scenario is the Product List. Therefore, the table_array is $A$4:$C$9. Your formula should now look like this: =VLOOKUP(A19,$A$4:$C$9

• Since we want Excel to fill in the Description, the col_index_num is 2. Your formula should now look like this: =VLOOKUP(A19,$A$4:$C$9,2

COMM 205: Introduction to Management Information SystemsLecture 04: Microsoft Excel – Part III

Page 18: COMM 205 2015W1 Lecture 04

VLOOKUP FUNCTION: EXACT MATCHES• Finally, we have to set [range_lookup] to FALSE because we want to find exact

matches. Your finished formula should look like this:

=VLOOKUP(A19,$A$4:$C$9,2,FALSE)

• Press enter, and then copy and paste the formula until you have reached cell B22. The results will temporarily be #N/A because we have not filled in the Product Code.

• Let’s type DC50 in cell A19, and MCA in cell A20.

• You can create a similar VLOOKUP function for the Unit Price (cells D19 through D28). Your formula should look like this:

=VLOOKUP(A19,$A$4:$C$9,3,FALSE)

• The only difference here is changing col_index_num to 3. Copy and paste the formula until you have reached cell D22.

• You can also make a formula for column E (Order Amount), which is Quantity * Unit Price. In cell E19, this will be = C19*D19

COMM 205: Introduction to Management Information SystemsLecture 04: Microsoft Excel – Part III

Page 19: COMM 205 2015W1 Lecture 04

VLOOKUP FUNCTION: EXACT MATCHES

Figure 6

COMM 205: Introduction to Management Information SystemsLecture 04: Microsoft Excel – Part III

Page 20: COMM 205 2015W1 Lecture 04

ADDITIONAL REFERENCES

• Gaskin, Shelley, et al. Go! With Microsoft Excel 2013 Comprehensive. Upper Saddle River: Pearson Prentice Hall, 2013. Print.

• Poatsy, Mary, et al. Exploring: Microsoft Excel 2013, Comprehensive. Upper Saddle River: Pearson Prentice Hall, 2013. Print.

COMM 205: Introduction to Management Information SystemsLecture 04: Microsoft Excel – Part III