Javatpoint Logo

91-9990449935

 0120-4256464

Excel If Function

The IF function or IF statement in Excel is composed of three parts separated by commas.

  • A condition
  • What to display if the condition is fulfilled
  • What to display if the condition is not fulfilled

See how the "IF function" is created step by step to find the safe and unsafe travelling speeds in the following example.

Excel If Function
  • Select the cell in which you want to create the "IF function"
  • Type the code in the cell: =if(
  • Type the condition with comma: B4>70,
  • Type what you want to show if condition is fulfilled. If you want to display text then write it within quotation marks: "Unsafe"
  • Type a comma: ,
  • Type what you want to show if the condition is not fulfilled within quotation marks: "Safe"
  • Then close the bracket and press the Enter key.

The IF function created above will look like this: =if(B4>70,"Unsafe","Safe")

So the IF function says if the speed or value in the cell B4 is more than 70 then display Unsafe and if it is less than 70 then display Safe.

After pressing the Enter key you will get the result for cell B4. Drag the fill handle downward till cell C9 to get status for other speeds of column B.