You are on page 1of 3

1)

IF Function to return Text =IF(C2>=B2,Yes,No) The formula means if C2 more or equals to B2, display Yes, else display No.

2)

IF Function to return a Value =IF(E2=Yes,(C2-B2) 1!",#) The formula calculates the commission based on a commission rate of 15% from the Total ales. This formula means if the cell !2 equals to Yes, the difference of cell C2 and cell B2 "ill multiple by 15% commission rate, else no commission is payable.

$)

Neste% IF #Note$ %a& ' () in nested* =IF(F2>1###,2##,IF(F2>!##,1##,#)) This formula means that if the commission is more than 1+++, than 2++ bonus is ,i-en, else if the commission is in bet"een 5++.1+++, 1++ bonus is ,i-en, else no bonus "ill be ,i-en.

&)

Alternatives to nested IF functions


Excel's IF function provides some simple decision-making capability to a worksheet. The IF function accepts three arguments

The condition being evaluated !should result in either T"#E or F$%&E' The value to display if the condition is T"#E The value to display if the condition is F$%&E

The formula below( for example( returns ) if cell $) contains *$*. If cell $) does not contain *$*( the formula returns an empty string. =IF(A1="A",1,"") For more decision-making power( you can *nest* IF functions within a formula. In other words( you can use an IF function as the second argument for an IF function. +ere's an example =IF(A1="A",1,IF(A1="B",2,IF(A1="C",3,""))) This formula checks cell $). If it contains *$*( the formula returns ). If it doesn't contain *$*( then the second argument is evaluated. The second argument contains another IF function that determines if $) contains a *,*. If so( the formula returns -. if not( the formula evaluates the IF function contained in the second argument and checks to see if $) contains */*. If so( it returns 0. otherwise( it returns an empty string. Excel allows up to seven levels of nested IF functions. The formula below works correctly( but Excel will not allow you to nest the IF functions any deeper than this. =IF(A1="A",1,IF(A1="B",2,IF(A1="C",3,IF(A1="D",4, IF(A1="E",5,IF(A1="F",6,IF(A1="G",7,IF(A1="H",8,"")))))))) The sections that follow present various ways to get around the limit of seven nested IF functions. ,e aware that these techni1ues may not be appropriate for all situations.

Using a VLOOKUP formula


In many cases( you can avoid using IF functions and use a 2%334#5 function. This will re1uire a separate table in your worksheet. In the figure below( the lookup table is in ,) /)6. The formula in $- is =VLOOKUP(A1,B1:C10,2)

Using defined names


$nother way to overcome the nested IF function limit is to use named formulas. /hip 5earson describes this techni1ue at his web site( so I won't repeat it here.

Nested IF Functions( at cpearson.com

Using the CONCATENATE function


7et another option was suggested to me by ,. 8anesh #se the /39/$TE9$TE function. In this case( each argument for /39/$TE9$TE consists of an IF function. +ere's an example

=CO CA!E A!E(IF(A1="A",1,""),IF(A1="B",2,""),IF(A1="C",3,""), IF(A1="D",4,""),IF(A1="E",5,""),IF(A1="F",6,""),IF(A1="G",7,""), IF(A1="H",8,""),IF(A1="I",",""),IF(A1="#",10,"")) The /39/$TE9$TE function can handle as many as 06 arguments -- which e1uates to testing 06 different conditions. $nd( as $lan :illiams pointed out( you can avoid using the /39/$TE9$TE function and use the concatenation operator !;' =IF(A1="A",1,"")$IF(A1="B",2,"")$IF(A1="C",3,"") $IF(A1="D",4,"")$IF(A1="E",5,"")$IF(A1="F",6,"") $IF(A1="G",7,"")$IF(A1="H",8,"")$IF(A1="I",","") $IF(A1="#",10,"") This method is not limited to 06 comparisons.

Use

oolean multi!lication

$nother alternative( suggest by <aniel Filer is to use ,oolean multiplication. This techni1ue takes advantage of the fact that( when multiplying( T"#E is treated as ) and F$%&E is treated as 6. +ere's an example =(A1="A")%1&(A1="B")%2&(A1="C")%3&(A1="D")%4&(A1="E")%5 &(A1="F")%6&(A1="G")%7&(A1="H")%8&(A1="I")%"&(A1="#")%10

Creating a custom V A function


The final alternative is to create a custom worksheet function( using 2,$. The advantage is that you can customi=e the function to meet your re1uirements( and your formulas can be simplified 1uite a bit.

You might also like