CIS 300- Professor Im Test #2 The function Syntax: =VLOOKUP(lookup_value,table_array,col_index_num,[range_lookup]) Arguments: •lookup_value Required The value to search in the first column of the table or range. •table_array Required The range of cells that contains the data. •col_index_num Required The column number in the table_array argument from which the matching value must be returned. •range_lookup Optional A logical value that specifies whether you want VLOOKUP to find an exact match or an approximate match. MICROSOFT® EXCEL® LOOKUP FUNCTIONS The function Description: •Searches the first column of a range of cells, and then returns a value from any cell on the same row of the range. Remarks: • The values in the first column of table_array can be text, numbers, or logical values. •Uppercase and lowercase text are equivalent. • If range_lookup is TRUE, the values in the first column of table_array must be placed in ascending order. • If range_lookup is TRUE or omitted, an approximate match is returned. • If range_lookup is FALSE, an exact match will be attempted. MICROSOFT® EXCEL® LOOKUP FUNCTIONS The function Errors: #VALUE! – If col_index_num is less than 1 #REF! – If col_index_num is greater than the number of columns in the table_array #N/A – If range_lookup is FALSE and an exact match cannot be found #N/A – If lookup_value is less than the smallest value in the first column of table_array MICROSOFT® EXCEL® LOOKUP FUNCTIONS The function – Example 1 1 2 3 4 =VLOOKUP(“CPU”,A1:F9,5,FALSE) =VLOOKUP(“CPU”,A1:F9,5,FALSE) =VLOOKUP(“CPU”,A1:F9,5,FALSE) =VLOOKUP(“CPU”,A1:F9,5,FALSE) 5 The function – Example 2 Q. How much total profit was made on the item that costs $40.00? A. =VLOOKUP(40,C2:F7,4,FALSE) The function Syntax: =HLOOKUP(lookup_value,table_array,row_index_num,[range_lookup]) Arguments: •lookup_value Required The value to search in the first column of the table or range. •table_array Required The range of cells that contains the data. •col_index_num Required The row number in the table_array argument from which the matching value must be returned. •range_lookup Optional A logical value that specifies whether you want VLOOKUP to find an exact match or an approximate match. MICROSOFT® EXCEL® LOOKUP FUNCTIONS The function Description: •Searches the first row of a range of cells, and then returns a value from any cell on the same column of the range. Remarks: • The values in the first column of table_array can be text, numbers, or logical values. •Uppercase and lowercase text are equivalent. • If range_lookup is TRUE, the values in the first column of table_array must be placed in ascending order. • If range_lookup is TRUE or omitted, an approximate match is returned. • If range_lookup is FALSE, an exact match will be attempted. MICROSOFT® EXCEL® LOOKUP FUNCTIONS The function – Example 1 =VLOOKUP(“Retail Value”,A1:F9,7,FALSE) =VLOOKUP(“Retail Value”,A1:F9,7,FALSE) =VLOOKUP(“Retail Value”,A1:F9,7,FALSE) =VLOOKUP(“Retail Value”,A1:F9,7,FALSE) The function – Example 2 Q. How many motherboards did they sell? A. =VLOOKUP(“Quantity”,A1:F9,6,FALSE) Some More Practice – EXAMPLE 1 Q. In the month with the most rainfall, how much damage did the rain cause? A. =VLOOKUP(MAX(B2:B13),B2:D13,3) = $250,000.00 MICROSOFT® EXCEL® LOOKUP FUNCTIONS Some More Practice – EXAMPLE 2 Q. If flooding occurred and the damages exceeded $100,000, the state will receive natural disaster funding. Which months will the state receive natural disaster funding. A. =IF(C2=“Yes”,IF(D2>100000, “Funds”, “No Funds”), “No Funds”) OR =IF(AND(C2=“Yes,D2>100000), “Funds”, “No Funds”) MICROSOFT® EXCEL® LOOKUP FUNCTIONS The function •Returns TRUE if value refers to any error value: •#N/A #VALUE! #REF! •#NUM! #NAME? #DIV/0! #NULL! MICROSOFT® EXCEL® INFORMATION FUNCTIONS The function MICROSOFT® EXCEL® INFORMATION FUNCTIONS Practice Questions Assume that cell E4 in a spreadsheet has the following formula: =AA$4+$C21 What formula will result from copying it into cell G8? =AC$4+$C25 Practice Questions What formula should be entered in cell E5 to do the following: • If the driver was going LESS THAN five miles over the speed limit, show the text “No Problem” • Otherwise, if the driver was speeding between 6 miles over and up to 15 miles over the speed limit, show a fine of $25 plus $10 per MPH over the stated speed limit • Otherwise, if the driver was speeding less than or equal to 35 MPH over the speed limit, show a fine of $250 even • Otherwise, show the text “Have Fun in Jail” Answer: =IF(D5<C5+5, “No Problem”, If(D5<=C5+15, 25+10*(D5-C5), IF(D5<=C5+35, 250, “Have Fun in Jail”))) (There are other equivalent answers) Practice Questions What is the formula to determine the name of the driver who was driving the 2nd slowest? =VLOOKUP(SMALL(D5:D9, 2),D5:F9,3,FALSE) EVALUATE: 1) =VLOOKUP(D15, $D$8:$F$20, 3, FALSE) 2) =VLOOKUP(SUM(B4:G4), $E$12:$G$24, 3, TRUE) 3) =VLOOKUP(MIN(B14:D18) + MAX(E3:G13), $C$10:$D$25, 2 Answers: 1: 49 2: 50 3: 89 Evaluate: 1) =VLOOKUP(B21, $C$11:$G$22, 4, TRUE) 2) =HLOOKUP(SMALL(G3:G10,4),B4:G10,4,FALSE) 3)=HLOOKUP(SUMIF(B3:G3,”>5”),C11:F24,COUNTIF(B3 :G3,”>5”),FALSE) Answers: 1) 61 2) 38 3) 46 Practice Questions A) What is the formula to determine the total number of employees who earn MORE than $50,000 in annual salary? B) What is the formula to determine the sum of the salaries of employees who earn LESS than the average annual salary for this group of employees? C) What is the formula to determine the sum of the salaries of employees who earn LESS than the fourth (4th) lowest salary? Answers: A) =COUNTIF(C4:C14,">50000") B) =SUMIF(C4:C14,"<"&AVERAGE(C4:C14)) C) =SUMIF(C4:C14,"<"&SMALL(C4:C14,4)) Practice Question Carefully examine the accompanying worksheet image. Airline passengers may have to pay a separate fee for checked bags at the time they obtain a boarding pass for their initial flight. If cell A1 contains the number of checked bags, provide a formula using only the cell references in the accompanying table that will correctly determine any baggage handling fee(s) that passengers must pay for their luggage. Note: The fee for the second bag is in addition to that charged for the first piece of checked luggage. Answer =IF(A1=B4,C4,IF(A1=B5,C4+C5,C3)) Practice Question Enter a formula into I2 that will determine how much an employee with the first name in cell I3 makes? If the first name does not exist, your answer should say "No such employee”. Answer: Vincent =IFERROR(VLOOKUP(I2,B2:H16,6,FALSE),"No Such Employee")