Part I: AND and OR FUNCTIONS: Today we are going to look at the AND and the OR Functions. For this, let’s use some new data. Open this workbook from Edmodo. A Name Linda Joe Bill Mary Mark John Ted 1 2 3 4 5 6 7 8 B District East West East South South North East C Sales 20000 42302 53001 12000 2050 9000 40000 D Emp. Years 2 9 3 12 6 0 4 E Job Level Let’s pretend this data shows your salespeople’s district, annual sales, and number of years employed by your company. Now, let’s suppose you want a formula in Column E that will assign a job level based on 2 criteria: • • Salespeople who have been employed for more than 5 years AND have had annual sales of more than $10,000 should be assigned a job code of “Level 2”. All others should have a job level of “Level 1”. To include two criteria, when both criteria MUST BE met, you must nest an AND function within your IF statement. TYPE this formula in cell E2: =IF((AND(D2>5,C2>10000)),”Level 2”,”Level 1”) Then, grab cell E2 by its FILL HANDLE and drag it down to cell E8 to copy it to the rest of cells in column E. This function uses a NESTED AND function for its “logical test”. The AND Function will decide if both conditions are true – what are the 2 conditions?. Similarly, you can use a NESTED OR function if you want a job level code “Level 2” to be applied if an employee meets EITHER condition, instead of both criteria. A nested OR functions works the same way as an AND function, except it will return a “Level 2”, if ANY of the criteria are met, instead of requiring that ALL criteria be met. Part II: 1. TYPE this equation in E2 now and copy it down to E8 (use the small black box at the bottom right of cell E2 and click and hold, drag it down to E8): =IF((OR(D2>5,C2>10000)),”Level 2”,”Level 1”) a. In this case, everyone is assigned a job “Level 2” except John, because he is the only one who did not meet either requirement, since he has NOT worked for the company for more than 5 years OR had annual sales greater than 10,000. b. You can use more than 2 criteria in nested ANDs and ORs. Simply separate them by commas. c. These examples work great when there are only two job levels, but what if there are more than two? In this case, you will have more than two criteria and more than one value if true and value if false. Let’s say we want to assign a job “Level 3” if the employee meets BOTH criteria, A job “Level 2” if the employee meets EITHER criteria above, And a job “Level 1” if the employee doesn’t meet any of the criteria above. TYPE this formula in E2 and copy it down to E8: =IF((AND(D2>5,C2>10000)),3,(IF((OR(D2>5,C2>10000)),2,1))) Notice what we are doing, here is basically nesting one IF statement within another. However, though we have two different logical tests and two different values if true, we only have one value if false. Type your name into cell A-10, then print the newly changed spreadsheet Are you having fun yet? Turn in both spreadsheets to Edmodo.