# =IF(A1>A2, A1, A2): if the value in A1 is greater than the value in A2, then the value in A1 is returned. If not, then the value in A2 is returned. : IF « Logical functions « Microsoft Office Excel 2007 Tutorial

```Input the formula: =IF(A1>A2, A1, A2)
```

 18.3.IF 18.3.1. IF(logical_test,value_if_true,value_if_false) specifies a logical test 18.3.2. =IF(A2=100,SUM(B5:B15),"") 18.3.3. =IF(A2>89,"A",IF(A2>79,"B", IF(A2>69,"C",IF(A2>59,"D","F")))) 79,"B", IF(A2>69,"C",IF(A2>59,"D","F"))))" src="http://www.java2s.com/Tutorial/Microsoft-Office-Excel-2007Images/ifa2gt89aifa2gt79b_Ifa2gt69cifa2gt5___Input_Formula_ifa289aifa279b_Ifa269.PNG" width=200 height=40> 18.3.4. Combine IF, AND and CHOOSE to display month name 18.3.5. Combine IF, OR and CHOOSE to display month name 18.3.6. =IF(A1>A2, A1, A2): if the value in A1 is greater than the value in A2, then the value in A1 is returned. If not, then the value in A2 is returned. 18.3.7. =IF(A1>A2, "Good!", "Bad!"): if the value in A1 is greater than the value in A2, then the text "Good!" is returned. Otherwise "Bad!" is returned.