Leading the way in Microsoft Office Development
 Home|Excel|Word|PowerPoint|Consultancy|Feedback|Contact 
 Microsoft Excel > Functions > Logical > IF

 

IF(logical_test, value_if_true, value_if_false)

 
 Returns the value based on a condition you specify.

 logical_testThe value or expression that can be evaluated to True or False.
 value_if_trueThe value that is returned if "logical_test" is True.
 value_if_falseThe value that is returned if "logical_test" is False.

 REMARKS
 
  • You can nest up to 7 IF functions.
     
  • Using nested IF functions is a common way to conditionally test, although try to avoid seven if possible as it requires a lot of effort to understand.
     
  • If any of the arguments to IF are arrays, every element of the array is evaluated when the IF statement is carried out.
     
  • The IF Function can be nested more than 7 times by splitting the formula into separate pieces. Use a named ranges to define your smaller bits. IF(OneToSix,OneToSix,SevenToThirteen), whereOneToSix has 6 nested IF statements and SevenToThirteen has another 7.
     
  • This function can return an array formula.

     EXAMPLES
     
     AB
    1=IF(50<100,"value less than 100","value greater than 100") = value less than 10050
    2=IF(5=5,"5","10") = 550
    3=IF(5=10,"5","10") = 1050
    4=IF(5=10,"","0") = 050
    5=IF(TRUE,) = 050
    6=IF(FALSE,) = False50
    7=IF(FALSE,"text if true","text if false") = text if false 
    8=IF(TRUE,50,100) = 50 
    9=IF(SUM(B1:B6)>200,SUM(B1:B4),SUM(B4:B6)) = 200 
    10=IF(AND(5=5,10-10),"true","false") = false 
    11=IF(2=1,1,IF(3=2,2,IF(4=3,3,IF(5=4,4,IF(6=5,5,IF(7=6,6,IF(8=7,7,100))))))) = 100 
     

     Functions - I | Index - I | Office Online 

     Copyright © 2004-2007 Better Solutions Limited. All Rights Reserved.Top