Sub topic 2
How a Function Call Is Written
Assume you can enter data and formulas in Google Sheets and understand cell addresses such as B2. A function call is a formula that asks Sheets to perform a named operation. The same structure works for SUM, AVERAGE, COUNT, MIN, and MAX.
The basic structure
A function call has four parts:
- An equals sign, which tells Sheets to calculate a formula.
- The function name, such as
SUM. - Parentheses around the inputs.
- One or more arguments, which are the values, cells, or ranges that the function uses.
=FUNCTION_NAME(argument1, argument2)For example:
=SUM(B2:B6)SUM is the function name. B2:B6 is the argument. The colon means “from B2 through B6,” including every cell between them.
A cell reference points to one cell. A range is a group of cells.
=B2
=SUM(B2:B6)The first formula refers to one cell. The second passes a five-cell range to the function.
Arguments and separators
An argument can be a cell reference, a range, a number, or another formula. Separate multiple arguments with commas.
=SUM(B2:B6, D2:D6, 100)This call passes three arguments:
- The range
B2:B6 - The range
D2:D6 - The number
100
The function combines all three according to its rules. A comma separates arguments. A colon describes the boundaries of one range. Do not confuse these symbols.
| Expression | Meaning |
|---|---|
| `B2:B6` | One range from B2 through B6 |
| `B2, B6` | Two separate cell arguments |
| `B2:B6, D2:D6` | Two separate ranges |
| `100` | A literal number |
Your spreadsheet locale may use semicolons instead of commas as argument separators. If a formula with commas is rejected, check the spreadsheet's locale settings before changing the function name.
Text and nested functions
Text used as a literal argument must usually be enclosed in quotation marks. This matters more with conditional functions, such as SUMIF, but the same argument rule applies generally.
=SUMIF(A2:A6, "Apples", B2:B6)Here, "Apples" is text. Without quotation marks, Sheets may interpret Apples as a named range or another identifier.
A function can also be an argument inside another function. This is called nesting.
=ROUND(AVERAGE(B2:B6), 2)Sheets evaluates the inner AVERAGE call first, then rounds its result to two decimal places. The opening and closing parentheses must match.
Common syntax errors
- Missing
=:SUM(B2:B6)may be treated as text instead of a formula. - Missing a parenthesis:
=SUM(B2:B6is incomplete. - Using a colon between separate arguments:
=SUM(B2:B6:D2:D6)is invalid. - Forgetting quotation marks around text:
=SUMIF(A2:A6, Apples, B2:B6)may not work. - Adding an extra comma:
=SUM(B2:B6,)can produce a formula parse error.
Exercise
Write a formula that passes the ranges B2:B6 and D2:D6, plus the number 50, to one SUM call.
Show answer
=SUM(B2:B6, D2:D6, 50)