43
Advanced Excel Functions

Functions - Richland School District Two · • Syntax: =VLOOKUP(lookup value, table array, column index, range lookup) • Lookup Value - The value you use to find the value you

  • Upload
    others

  • View
    11

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Functions - Richland School District Two · • Syntax: =VLOOKUP(lookup value, table array, column index, range lookup) • Lookup Value - The value you use to find the value you

Advanced Excel Functions

Page 2: Functions - Richland School District Two · • Syntax: =VLOOKUP(lookup value, table array, column index, range lookup) • Lookup Value - The value you use to find the value you

TOPICS

• Welcome to Richland Two’s Advanced Excel class. Today we will cover just a few of the functions available in Excel.

• In addition, we will cover how create a named range, use data validation, and protect your formulas.

LOOKUP / REFERENCE LOGICAL MATHEMATICAL

MATCH IF SUMIF

VLOOKUP AND COUNTIF

OR

Page 3: Functions - Richland School District Two · • Syntax: =VLOOKUP(lookup value, table array, column index, range lookup) • Lookup Value - The value you use to find the value you

MATCH

• Returns the relative position of an item in an array that matches a specified value in a specified order. Use MATCH instead of one of the LOOKUP functions when you need the position of an item in a range instead of the item itself.

• Syntax: =MATCH(lookup value, lookup array, match type) • Lookup Value - the value you use to find the value you want in a table. For

example, when you look up someone's number in a telephone book, you are using the person's name as the lookup value, but the telephone number is the value you want.

• Lookup Array – the range of cells containing possible lookup values.

• Match Type – the number -1, 0, or 1. The match type specifies how Excel matches lookup value with values in lookup array.

Page 4: Functions - Richland School District Two · • Syntax: =VLOOKUP(lookup value, table array, column index, range lookup) • Lookup Value - The value you use to find the value you

MATCH

• Match Type – the number -1, 0, or 1. The match type specifies how Excel matches lookup value with values in lookup array. • If match type is 1, MATCH finds the largest value that is less than or equal

to lookup value. The argument lookup array must be placed in ascending order.

• If match type is 0, MATCH finds the first value that is exactly equal to lookup value.

• If match type is -1, MATCH finds the smallest value that is greater than or equal to lookup value. The argument lookup array must be placed in descending order.

Page 5: Functions - Richland School District Two · • Syntax: =VLOOKUP(lookup value, table array, column index, range lookup) • Lookup Value - The value you use to find the value you

MATCH

• Activity 1 • The ACT 1 worksheet lists the seniors by student number and name. The

Diploma worksheet has the student numbers of the seniors who have had a diploma ordered.

• Use the MATCH function to determine which of the seniors have not had a diploma ordered. • Lookup Value – student number in A2

• Lookup Array – student numbers in Diploma!A2:A:100

• Match Type – exact

• Include $ in front of the Lookup Array cell references

Page 6: Functions - Richland School District Two · • Syntax: =VLOOKUP(lookup value, table array, column index, range lookup) • Lookup Value - The value you use to find the value you

MATCH

• Activity 1 • Solution

• =MATCH(A2,Diploma!$A$1:$A$100,0)

• Result

• Column C now lists the row number on the Diploma worksheet where the

student number of those who had a diploma orders can be found. For example, Kevin Brady’s student number was found on the 52nd row of the Lookup Array. Students whose number was not in the Lookup Array, and therefore, have not had a diploma ordered are identified with #N/A.

• You should find 5 students with #N/A.

Page 7: Functions - Richland School District Two · • Syntax: =VLOOKUP(lookup value, table array, column index, range lookup) • Lookup Value - The value you use to find the value you

VLOOKUP

• Returns the value of an item in an array that matches a specified value in a specified order. Use VLOOKUP to search the first column of a range of cells, and then return a value from any cell on the same row of the range.

• Syntax: =VLOOKUP(lookup value, table array, column index, range lookup) • Lookup Value - The value you use to find the value you want in a table.

• Table Array – The range of cells that contains the data. You can use a reference

to a range (for example, A2:D8), or a range name. The values in the first column of table array are the values searched by lookup value.

• Column Index – The column number in the table array argument from which the matching value must be returned.

• Range Lookup – Either TRUE for approximate or FALSE for exact values.

Page 8: Functions - Richland School District Two · • Syntax: =VLOOKUP(lookup value, table array, column index, range lookup) • Lookup Value - The value you use to find the value you

VLOOKUP

• Activity 2 • The ACT 2 worksheet lists the students by student number and name. The

Homeroom worksheet has the student number and the name of the homeroom teacher for each student.

• Use the VLOOKUP function to report the homeroom teacher for each student. • Lookup Value – student number in A2

• Table Array – student numbers in Homeroom!A2:B:434

• Column Index – Homeroom teacher names are in column 2 of the array

• Range Lookup – exact, so FALSE or 0.

• Include $ in front of the Table Array cell references

Page 9: Functions - Richland School District Two · • Syntax: =VLOOKUP(lookup value, table array, column index, range lookup) • Lookup Value - The value you use to find the value you

VLOOKUP

• Activity 2 • Solution

• =VLOOKUP(A2,HOMEROOM!$A$1:$B$434,2,0)

• Result

• Column C now lists the name of the homeroom teacher for each student.

Page 10: Functions - Richland School District Two · • Syntax: =VLOOKUP(lookup value, table array, column index, range lookup) • Lookup Value - The value you use to find the value you

VLOOKUP

• Activity 3 • The ACT 3 worksheet lists the students by student number and name. It also

includes course names, course numbers, and a numeric grade for each course. The Grades worksheet lists the numeric and corresponding letter grades.

• Use the VLOOKUP function to report the letter grade for each numeric grade. • Lookup Value – numeric grade in E2

• Table Array – numeric and letter grade table in Grades!A1:B5

• Column Index – the letter grades are in column 2 of the array

• Range Lookup – approximate, so True, or 1, or omitted.

• Include $ in front of the Table Array cell references

Page 11: Functions - Richland School District Two · • Syntax: =VLOOKUP(lookup value, table array, column index, range lookup) • Lookup Value - The value you use to find the value you

VLOOKUP

• Activity 3 • Solution

• =VLOOKUP(E2,Grades!$A$1:$B$5,2,1)

• Result

• Column F now contains the letter grade for each numeric grade.

• *Important: The numeric grades must be listed from low to high in the table

array. When using an approximate Range Lookup, VLOOKUP begins at the top of the specific column and searches down the column (vertical) until it finds the an exact match or the largest value that is less than the Lookup Value.

Page 12: Functions - Richland School District Two · • Syntax: =VLOOKUP(lookup value, table array, column index, range lookup) • Lookup Value - The value you use to find the value you

CREATING A NAMED RANGE

• Using a named range can simplify the Table Array portion of the function.

• Activity 4 • Open the Grades worksheet and select cells A1 through B5.

• Click in the name box portion of the formula box and type Grades.

• (E2,Grades!$A$1:$B$5,2,1) becomes (E2,Grades!Grades,2,1).

Page 13: Functions - Richland School District Two · • Syntax: =VLOOKUP(lookup value, table array, column index, range lookup) • Lookup Value - The value you use to find the value you

IF

• Returns one value if a condition you specify evaluates to TRUE, and another value if that condition evaluates to FALSE.

• Syntax: =IF(Logical Test, Value if True, Value if False) • Logical Test – Any value or expression that can be evaluated to TRUE or FALSE.

For example, A10=100 is a logical expression.

• Value if True – The value that you want to be returned if the logical test argument evaluates to TRUE.

• Value if False – The value that you want to be returned if the logical test argument evaluates to FALSE.

Page 14: Functions - Richland School District Two · • Syntax: =VLOOKUP(lookup value, table array, column index, range lookup) • Lookup Value - The value you use to find the value you

IF

• Activity 5 • The ACT 5 worksheet lists the students by student number, name, gender, and

ethnicity.

• Use the IF function to determine which students are ethnic minorities (non-white).

Page 15: Functions - Richland School District Two · • Syntax: =VLOOKUP(lookup value, table array, column index, range lookup) • Lookup Value - The value you use to find the value you

IF

• Activity 5 • Solution

• =IF(D2="W","No","Yes")

• =IF(D2<>"W", "Yes", "No")

• Result

• Column E now has a "No" for white students. All other students are

considered minorities and have a "Yes" in column E.

• You should have 75 minority students.

Page 16: Functions - Richland School District Two · • Syntax: =VLOOKUP(lookup value, table array, column index, range lookup) • Lookup Value - The value you use to find the value you

AND

• Returns TRUE if all its arguments evaluate to TRUE; returns FALSE if one or more arguments evaluate to FALSE.

• Syntax: =AND(Logical 1, Logical 2,…) • Logical 1 – The first condition that you want to test that can evaluate to either

TRUE or FALSE.

• Logical 2,… – The second and additional conditions that you want to test that can evaluate to either TRUE or FALSE.

Page 17: Functions - Richland School District Two · • Syntax: =VLOOKUP(lookup value, table array, column index, range lookup) • Lookup Value - The value you use to find the value you

AND

• Activity 6 • The ACT 6 worksheet lists the students by student number, name, gender, and

ethnicity.

• Use the AND function to determine which students are Asian (A) and female (F).

Page 18: Functions - Richland School District Two · • Syntax: =VLOOKUP(lookup value, table array, column index, range lookup) • Lookup Value - The value you use to find the value you

AND

• Activity 6 • Solution

• =AND(C2="F",D2="A")

• Result • Column E now has a "TRUE" for Asian female students. All other students

have a "FALSE" in column E.

• You should have 6 Asian female students.

Page 19: Functions - Richland School District Two · • Syntax: =VLOOKUP(lookup value, table array, column index, range lookup) • Lookup Value - The value you use to find the value you

Combining AND With IF

• One common use for the AND function is to expand the usefulness of other functions that perform logical tests. For example, the IF function performs a logical test and then returns one value if the test evaluates to TRUE and another value if the test evaluates to FALSE. By using the AND function as the logical test argument of the IF function, you can test many different conditions instead of just one or receive a more meaningful returned value.

• Syntax: =IF(AND(Logical 1, Logical 2,…),Value if True, Value if False)

Page 20: Functions - Richland School District Two · • Syntax: =VLOOKUP(lookup value, table array, column index, range lookup) • Lookup Value - The value you use to find the value you

Combining AND With IF

• Activity 7 • The ACT 7 worksheet lists the students by student number, name, gender, and

ethnicity.

• Combine the AND function with the IF function to determine which students are Asian (A) and Female (F).

Page 21: Functions - Richland School District Two · • Syntax: =VLOOKUP(lookup value, table array, column index, range lookup) • Lookup Value - The value you use to find the value you

Combining AND With IF

• Activity 7 • Solution

• =IF(AND(C2="F",D2="A"),"Yes","No")

• Result • Column E now has a "Yes" for Asian female students. All other students

have a "No" in column E.

• You should have 6 Asian female students.

Page 22: Functions - Richland School District Two · • Syntax: =VLOOKUP(lookup value, table array, column index, range lookup) • Lookup Value - The value you use to find the value you

OR

• Returns TRUE if one its arguments evaluate to TRUE; returns FALSE if all arguments evaluate to FALSE.

• Syntax: =OR(Logical 1, Logical 2,…) • Logical 1 – The first condition that you want to test that can evaluate to either

TRUE or FALSE.

• Logical 2,… – The second and additional conditions that you want to test that can evaluate to either TRUE or FALSE.

Page 23: Functions - Richland School District Two · • Syntax: =VLOOKUP(lookup value, table array, column index, range lookup) • Lookup Value - The value you use to find the value you

OR

• Activity 8 • The ACT 8 worksheet lists the students by student number, name, gender, and

ethnicity.

• Use the OR function to determine which students are ethnic minorities or female (F).

Page 24: Functions - Richland School District Two · • Syntax: =VLOOKUP(lookup value, table array, column index, range lookup) • Lookup Value - The value you use to find the value you

OR

• Activity 8 • Solution

• =OR(C2="F",D2<>"W")

• Result • Column E now has a "TRUE" for student who are either ethnic minorities

or female. White male students have a "FALSE" in column E.

• You should have 128 students who are a minority or female.

Page 25: Functions - Richland School District Two · • Syntax: =VLOOKUP(lookup value, table array, column index, range lookup) • Lookup Value - The value you use to find the value you

Combining OR With IF

• Just as AND can be combined with IF, OR can also be used in combination. By using the OR function as the logical test argument of the IF function, you can test many different conditions instead of just one or receive a more meaningful returned value.

• Syntax: =IF(OR(Logical 1, Logical 2,…),Value if True, Value if False)

Page 26: Functions - Richland School District Two · • Syntax: =VLOOKUP(lookup value, table array, column index, range lookup) • Lookup Value - The value you use to find the value you

Combining OR With IF

• Activity 9 • The ACT 9 worksheet lists the students by student number, name, gender, and

ethnicity.

• Combine the OR function with the IF function to determine which students are minorities or are female (F).

Page 27: Functions - Richland School District Two · • Syntax: =VLOOKUP(lookup value, table array, column index, range lookup) • Lookup Value - The value you use to find the value you

Combining OR With IF

• Activity 9 • Solution

• =IF(OR(C2="F",D2<>"W"),"Yes","No")

• Result • Column E now has a "Yes" for student who are either ethnic minorities or

female. White male students have a "No" in column E.

• You should have 128 students who are a minority or female.

Page 28: Functions - Richland School District Two · • Syntax: =VLOOKUP(lookup value, table array, column index, range lookup) • Lookup Value - The value you use to find the value you

COUNTIF

• The COUNTIF function counts the number of cells within a range that meet a single criterion that you specify. For example, you can count all the cells that start with a certain letter, or you can count all the cells that contain a number that is larger or smaller than a number you specify.

• Syntax: =COUNTIF(Range, Criteria) • Range – One or more cells to count, including numbers or names, arrays, or

references that contain numbers. Blank and text values are ignored.

• Criteria – A number, expression, cell reference, or text string that defines which cells will be counted. For example:

12 >12 C22 “NOT MET”

Page 29: Functions - Richland School District Two · • Syntax: =VLOOKUP(lookup value, table array, column index, range lookup) • Lookup Value - The value you use to find the value you

COUNTIF

• Activity 10 • Solution

• =COUNTIF(C2:C434,"Pierce")

• Result

• The cell in which you entered the function should now show there are 26

students in Pierce’s homeroom.

Page 30: Functions - Richland School District Two · • Syntax: =VLOOKUP(lookup value, table array, column index, range lookup) • Lookup Value - The value you use to find the value you

SUMIF

• Returns the sum of the values in a range that meet criteria that you specify. For example, the sum of only the values that are larger than 5.

• Syntax: =SUMIF(Range, Criteria, Sum Range) • Range – One or more cells to count, including numbers or names, arrays, or

references that contain numbers. Blank and text values are ignored.

• Criteria – A number, expression, cell reference, or text string that defines which cells will be counted.

• Sum Range – The actual cells to add, if you want to add cells other than those specified in the range argument. If the sum range argument is omitted, Excel adds the cells that are specified in the range argument

Page 31: Functions - Richland School District Two · • Syntax: =VLOOKUP(lookup value, table array, column index, range lookup) • Lookup Value - The value you use to find the value you

SUMIF

• Activity 11 • The ACT 11 worksheet lists the students by student number and name. It also

lists fees that have been charged to a group of students. The fee type, fee amount, amount paid, and balance are also listed.

• Use the SUMIF function to determine the total amount of Student Activity fees that have been charged to this group of students.

Page 32: Functions - Richland School District Two · • Syntax: =VLOOKUP(lookup value, table array, column index, range lookup) • Lookup Value - The value you use to find the value you

SUMIF

• Activity 11 • Solution

• =SUMIF(D2:D85,"Student Activity",E2:E85)

• Result • The cell in which you entered the function should now show that this

group of students have been charges a total of $650.00 in Student Activity fees.

Page 33: Functions - Richland School District Two · • Syntax: =VLOOKUP(lookup value, table array, column index, range lookup) • Lookup Value - The value you use to find the value you

DATA VALIDATION

• Data validation is an Excel feature that you can use to define restrictions on what data can or should be entered in a cell. You can configure data validation to prevent users from entering data that is not valid. If you prefer, you can allow users to enter invalid data but warn them when they try to type it in the cell. You can also provide messages to define what input you expect for the cell, and instructions to help users correct any errors.

• Activity 12 • The Activity 12 worksheet lists the students by student number, name, and

grade. There is also a column to enter the students’ method of transportation and a column for entering their first and second choices for elective courses. The Elective worksheet lists the available elective courses.

• Use data validation to limit the user’s choices for transportation and electives.

Page 34: Functions - Richland School District Two · • Syntax: =VLOOKUP(lookup value, table array, column index, range lookup) • Lookup Value - The value you use to find the value you

DATA VALIDATION

• Data validation is on the Data Tab in the Excel Ribbon.

Page 35: Functions - Richland School District Two · • Syntax: =VLOOKUP(lookup value, table array, column index, range lookup) • Lookup Value - The value you use to find the value you

DATA VALIDATION

• On the settings tab, change the Validation criteria from Any value to list.

Page 36: Functions - Richland School District Two · • Syntax: =VLOOKUP(lookup value, table array, column index, range lookup) • Lookup Value - The value you use to find the value you

DATA VALIDATION

• In the Source box, type the options (separated by commas).

• The Input Message and Error Alert are optional, but can be helpful.

Page 37: Functions - Richland School District Two · • Syntax: =VLOOKUP(lookup value, table array, column index, range lookup) • Lookup Value - The value you use to find the value you

DATA VALIDATION

• When cell E2 is active, a “drop down” selection box appears. The acceptable options can be selected.

• Copy cell E2 and paste it into the rest of column.

Page 38: Functions - Richland School District Two · • Syntax: =VLOOKUP(lookup value, table array, column index, range lookup) • Lookup Value - The value you use to find the value you

DATA VALIDATION

• The list of elective courses is longer than you would want to type in the box and you have them in a prepared list. Click on the range selection icon at the end of the source box.

Page 39: Functions - Richland School District Two · • Syntax: =VLOOKUP(lookup value, table array, column index, range lookup) • Lookup Value - The value you use to find the value you

DATA VALIDATION

• A small box will appear. You can either type in the cell reference or use your mouse to select the range.

Page 40: Functions - Richland School District Two · • Syntax: =VLOOKUP(lookup value, table array, column index, range lookup) • Lookup Value - The value you use to find the value you

DATA VALIDATION

• The cell range for elective courses is =ELECTIVE!$A$2:$A$17

Page 41: Functions - Richland School District Two · • Syntax: =VLOOKUP(lookup value, table array, column index, range lookup) • Lookup Value - The value you use to find the value you

WORKSHEET PROTECTION

• Worksheet protection allows you to lock selected cells to prevent them from being edited.

• The column E of Activity 13 worksheet has formulas. Use worksheet protection to prevent others from changing or deleting your formula.

• Protect Sheet is found on the Review Tab of the Excel Ribbon.

Page 42: Functions - Richland School District Two · • Syntax: =VLOOKUP(lookup value, table array, column index, range lookup) • Lookup Value - The value you use to find the value you

WORKSHEET PROTECTION

• All cells are locked by default, but the worksheet protection is not active. Since all cells are currently locked, you need to unlock them first.

• This is done by removing the check in box in front of Select locked cells. Click OK.

Page 43: Functions - Richland School District Two · • Syntax: =VLOOKUP(lookup value, table array, column index, range lookup) • Lookup Value - The value you use to find the value you

WORKSHEET PROTECTION

• By pressing the CTRL button and the ~ button at the same time you can see which cells have formulas or functions that you want to protect (column E).

• Select E2:E434, return to Protect Sheet and lock these cells. Click OK.