How to use the IF function in Apple Numbers

What are the variables or parameters of the IF function?

Every IF function in Mac Numbers has three main parameters: the condition (if-expression), the display value when the condition is right (if-true), and the display value when the condition is wrong (if-false).  

If-expression: a condition, a comparison, or a function that returns true or false. For example, “2 > 3” or “A1 > B1” or ISERROR().

If-true: the display value when the condition is right. For example, the following IF function displays “Yes, It is true”. IF( “2>3” , “Yes, It is true” , ”No, It is false” ).

If-false: the display value when the condition is wrong. For example, the following IF function displays “No, It is false”. IF( “2>3” , “Yes, It is true” , ”No, It is false” )

How do you write if a cell contains specific text?

You must use the two functions ISERROR and SEARCH to express the “if contain specific text” condition. The SEARCH function tries to find the specific text in your value. It returns an ERROR when it doesn’t find the text. So ERROR means the value doesn’t contain the specific text. And you need the ISERROR function to give the If function an if-true or if-false outcome. 

For example, an IF function to check if “Hello Dave” contains “Dave” text. IF( ISERROR( SEARCH(“Dave”, “Hello Dave”) ), “Yes”, “No” )

How to make the If-false outcome to display nothing?

Simply write nothing and leave no space between the double quotation marks “”. You are telling the if function to display nothing when the outcome is if-false. 

Obviously “2 > 3” is false, and the following if function displays nothing. IF( “2>3”, “True” , “” )

How to change the cell color based on the if function outcome?

There is no way to change the cell color in the if function. But the following steps will help you achieve the same effect.

  • Step 1: Set up the if function to return “true” value or “false” value
  • Step 2: Use Conditional Highlighting to set up color rules according to cell values

For example, the following if function returns true when “2 < 3”. Then the Conditional Highlighting rule changes the cell to green color.

Tech Wizard

Passionate full-time web designer and programmer. Find beauty in simplicity and efficiency.