Sunteți pe pagina 1din 2

Excel Function Dictionary 1998 - 2000 Peter Noneley A 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 B C D E F G H I

IF Page 1 of 2

IF
Name Alan Bob Carol Sales 1000 6000 2000 Target 5000 5000 4000 Result Not Achieved =IF(C4>=D4,"Achieved","Not Achieved") Achieved =IF(C5>=D5,"Achieved","Not Achieved") Not Achieved =IF(C6>=D6,"Achieved","Not Achieved")

What Does It Do? This function tests a condition. If the condition is met it is considered to be TRUE. If the condition is not met it is considered as FALSE. Depending upon the result, one of two actions will be carried out. Syntax =IF(Condition,ActionIfTrue,ActionIfFalse) The Condition is usually a test of two cells, such as A1=A2. The ActionIfTrue and ActionIfFalse can be numbers, text or calculations. Formatting No special formatting is required. Example 1 The following table shows the Sales figures and Targets for sales reps. Each has their own target which they must reach. The =IF() function is used to compare the Sales with the Target. If the Sales are greater than or equal to the Target the result of Achieved is shown. If the Sales do not reach the target the result of Not Achieved is shown. Note that the text used in the =IF() function needs to be placed in double quotes "Achieved". Name Alan Bob Carol Sales 1000 6000 2000 Target 5000 5000 4000 Result Not Achieved =IF(C31>=D31,"Achieved","Not Achieved") Achieved =IF(C32>=D32,"Achieved","Not Achieved") Not Achieved =IF(C33>=D33,"Achieved","Not Achieved")

Example 2 The following table is similar to that in Example 1. This time the Commission to be paid to the sales rep is calculated. If the Sales are greater than or equal to the Target, the Commission is 10% of Sales. If the Sales do not reach Target, the Commission is only 5% of Sales. Name Alan Bob Carol Sales 1000 6000 2000 Target 5000 5000 4000 Commission 50 =IF(C43>=D43,C43*10%,C43*5%) 600 =IF(C44>=D44,C44*10%,C44*5%) 100 =IF(C45>=D45,C45*10%,C45*5%)

Example 3 This example uses the =AND() within the =IF() function. A builders merchant gives 10% discount on certain product lines.

Excel Function Dictionary 1998 - 2000 Peter Noneley A 51 52 53 54 55 56 57 58 59 60 61 62 B C D E F G H The discount is only given on products which are on Special Offer, when the Order Value is 1000 or above. The =AND() function is used with the =IF() to check that the product is on offer and that the value of the order is above 1000. Special Offer Yes No Yes Yes Order Value 2,000 2,000 500 3,000 I

IF Page 2 of 2

Product Wood Glass Cement Turf

Discount Total 200 1,800 2,000 500 300 2,700 =IF(AND(C61="Yes",D61>=1000),D61*10%,0)

S-ar putea să vă placă și