Excel course · Lesson 5 of 34

Introduction to functions: reading syntax and nesting

Learn what a function is, how to read its syntax and arguments, use AutoSum and Insert Function, and nest one function inside another.

Beginner 16 min read

Excel has more than 500 built-in functions: ready-made formulas that do a job you would otherwise have to write out by hand. Adding 1,000 cells with + would be absurd; =SUM(B2:B1001) does it in one short instruction. In this lesson you will learn how any function is built, how to read its syntax from the tooltip, how to find the right function, and how to combine functions by nesting them.

The structure of a function

A function call has a name, followed by parentheses, and inside them the arguments, the inputs the function needs, separated by commas:

Formula
=ROUND(B7, 2)
=SUM(B2:B6)
=IF(C2>=50, "Pass", "Fail")
=TODAY()
  • ROUND is the name. Names are not case-sensitive; Excel converts round to ROUND when you press Enter.
  • B7 and 2 are the arguments: the number to round and how many decimals to keep.
  • Arguments can be numbers, text in double quotes, cell references, ranges, logical values (TRUE/FALSE) or other formulas.
  • Some functions need no arguments at all, like TODAY and NOW, but the empty parentheses are still required.
Note. In many European regional settings the argument separator is a semicolon instead of a comma: =ROUND(B7; 2). This course uses commas. If Excel rejects a formula from this site, swap the commas for semicolons. The separator follows the decimal separator chosen in Windows or macOS regional settings.

Reading syntax

When you type =VLOOKUP( Excel shows a yellow tooltip with the syntax. Function pages on this site show the same thing. Here is how to read it:

Formula
ROUND(number, num_digits)
XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])
SUM(number1, [number2], ...)
Arguments in square brackets are optional.
  • Arguments without brackets are required. Leave one out and Excel refuses the formula.
  • Arguments in square brackets are optional and have a default value. In XLOOKUP, leaving out match_mode means exact match.
  • ... means the argument can repeat. SUM accepts up to 255 numbers or ranges: =SUM(B2:B6, D2:D6, 100).
  • The bold argument in the tooltip is the one you are typing now. Click an argument name in the tooltip to select that part of the formula.

Six functions every user needs

B7fx=AVERAGE(B2:B6)
ABCD
1StudentTest 1Test 2Test 3
2Ana788591
3Ben647058
4Carla928895
5David55absent73
6Elif817984
774

Grades for five students. David missed Test 2, so C5 contains the text 'absent'.

Result: 74

FormulaWhat it doesResult
=SUM(B2:B6)Adds the numbers370
=AVERAGE(B2:B6)Arithmetic mean74
=MIN(B2:B6)Smallest value55
=MAX(B2:B6)Largest value92
=COUNT(C2:C6)Counts cells that contain numbers4
=COUNTA(C2:C6)Counts cells that are not empty5
=AVERAGE(C2:C6)Mean of Test 2, ignoring the text80.5

Look at the last three rows. COUNT only counts numbers, so David's 'absent' is skipped, while COUNTA counts every non-empty cell. AVERAGE also skips text, so the Test 2 average is calculated over four students. Whether that is fair is a business decision; if absent should count as zero, enter 0 instead of text.

Three ways to insert a function

1. AutoSum

  1. Click the cell under a column of numbers, for example B7.
  2. Choose Home › Editing › AutoSum (the Σ button) or press Alt+= (Mac: Cmd+Shift+T).
  3. Excel guesses the range and shows =SUM(B2:B6) with a moving border. Check the range, adjust it by dragging if needed, and press Enter.
  4. Click the small arrow next to AutoSum to choose Average, Count Numbers, Max or Min instead.
Tip. Select a block of numbers plus an empty row below and an empty column to the right, then press Alt+=. Excel writes all the row and column totals in one go.

2. Insert Function dialog

  1. Click the cell for the result and choose Formulas › Function Library › Insert Function, or click the fx button left of the formula bar (Shift+F3).
  2. Type a description such as round a number and click Go, or pick a category.
  3. Select ROUND and click OK. The Function Arguments dialog opens with one box per argument and a short description of each.
  4. Fill in the boxes. The dialog previews the result at the bottom. Click OK.

The Function Arguments dialog is excellent for learning a new function, because it shows each argument's purpose and the current value of every input as you type.

3. Type it with Formula AutoComplete

Type = and the first letters, for example =AV. A list drops down with AVERAGE, AVERAGEA, AVERAGEIF and AVERAGEIFS. Use the arrow keys to choose and press Tab to accept; Excel adds the opening parenthesis. This is the fastest method once you know what you want.

Nesting functions

Any argument can itself be a function. Putting one function inside another is called nesting. Excel always calculates the innermost function first and passes its result outwards.

E2fx=ROUND(AVERAGE(B2:D2), 1)
ABCDE
1StudentTest 1Test 2Test 3Average
2Ana78859184.7
3Ben64705864
4Carla92889591.7

AVERAGE calculates 84.666…, then ROUND keeps one decimal.

Result: 84.7

Read nested formulas from the inside out: first AVERAGE(B2:D2) = 84.666…, then ROUND(84.666…, 1) = 84.7. Another common pattern is =IF(COUNT(B2:D2)<3, "Incomplete", AVERAGE(B2:D2)): count the scores first, and only average them if all three exist.

Watch out. Rounding with a number format (Home › Number › Decrease Decimal) changes only what you see; the cell still holds 84.666…. Totals of displayed values may then look off by a cent. Use ROUND when the stored value itself must be rounded, for example on invoices.
Tip. When building a nested formula, write it in steps: put =AVERAGE(B2:D2) in a helper cell, check it, then wrap it: =ROUND(AVERAGE(B2:D2),1). Excel colours matching parentheses as you type, which helps you see where each function ends.

Function categories

Functions are grouped on the Formulas tab: Financial, Logical, Text, Date & Time, Lookup & Reference, Math & Trig, and More Functions (Statistical, Engineering, Information and others). You will meet the most useful ones in later lessons: IF in IF and logical formulas: AND, OR, NOT, IFS and SWITCH, XLOOKUP in Lookup guide: VLOOKUP vs INDEX/MATCH vs XLOOKUP, SUMIFS in Counting and summing with criteria: COUNTIFS, SUMIFS, SUMPRODUCT.

Note. Newer functions such as XLOOKUP, FILTER and LET exist only in Microsoft 365 and Excel 2021 or later. If you open such a workbook in Excel 2016 or 2019, those cells show #NAME? (older versions prefix the name with _xlfn. in the formula bar). Every function page on this site lists its availability.

Check yourself

1. In the syntax XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found]), what do the square brackets mean?

2. C2:C6 contains 85, 70, "absent", 88 and 79. What does =COUNT(C2:C6) return?

3. What does =ROUND(AVERAGE(10, 11, 11), 1) return?

4. Which shortcut inserts AutoSum on Windows?

5. A colleague with Excel 2016 opens your file and sees #NAME? where you used XLOOKUP. Why?

⬇Practice workbookExamples with live formulas + practice sheets · .xlsx · 14 KB