The syntax of a function in Excel or Google Sheets refers to the layout and order of the function and its arguments. A function in Excel and Google Sheets is a built-in formula. All functions begin with the equal sign ( = ) followed by the function’s name such as IF, SUM, COUNT, or ROUND. When you use the correct syntax for functions in Excel or Google Sheets, you’ll avoid error messages.
The IF Function Syntax
A function’s arguments refer to all the data or information required by a function. These arguments must be entered in the correct order. As an example, the syntax of the IF function in Excel is:
The instructions in this tutorial apply to Excel 2019, Excel 2016, Excel 2013, Excel 2010, Excel 2007, Excel Online, and Excel for Mac.
=IF(Logical_test,Value_if_true,Value_if_false)
Parenthesis and Commas
In addition to the order of arguments, the term syntax also refers to the placement of round brackets or parenthesis surrounding the arguments and to the use of the comma as a separator between the individual arguments.
Reading the IF Function’s Syntax
The IF function in Excel and in Google Sheets has three arguments arranged in the following order:
Since the syntax of the IF function requires a comma to separate the three arguments of the function, do not use a comma in numbers greater than 1000.
- Logical_test argumentValue_if_true argumentValue_if_false argument
If the arguments are placed in a different order, the function returns an error message or an unexpected answer.
Required vs. Optional Arguments
One piece of information that the syntax does not relate is whether an argument is required or optional. In the case of the IF function, the first and second arguments (the Logical_test and the Value_if_true arguments) are required. The third argument, the Value_if_false argument, is optional.
If the third argument is omitted from the function and the condition tested by the function’s Logical_test argument evaluates to false, then the function displays the term FALSE in the cell where the function is located.
Get the Latest Tech News Delivered Every Day