edubun
English
1 / 22

2 / 6 · Basic

SUM, AVERAGE, COUNT, MIN and MAX

Six students, four scores, the word absent and an empty cell: AVERAGE divides by 4 here, not by 6, because it skips text and empty cells but counts the 0.

Jump to the 12 practice questions

You will learn

  • Tell COUNT from COUNTA, and a blank from a zero
  • Choose the mean, median or mode

Before this: Absolute and mixed references

1Explain

A score sheet with one absence and one missing mark

Picture the score sheet in the lab below. Ana has 82, Chloe 91, Eli 0 and Fay 77. Ben was absent, so someone typed the word absent. Dev's test hasn't been marked yet, so his cell is empty. What is the class average? Count the cells and you might divide by 6. AVERAGE divides by 4 and gets 62.5, the same answer as someone with a calculator who skips Ben and Dev.

2Explain

Five functions, one rule

The rule behind that answer is short. SUM adds, AVERAGE gives the arithmetic mean, MIN and MAX give the smallest and largest number, and COUNT says how many numbers there are. All five take a range such as B2:B7, or several ranges separated by commas. These functions normally ignore text and blanks in a range. COUNT also ignores error values, but SUM and AVERAGE can pass an error to their result. Microsoft's AVERAGE page puts it plainly: text, logical values and empty cells in a range are ignored, but cells with the value zero are included.

3Problem

The class average

B2:B7 holds 82, absent, 91, (empty), 0, 77. What does =AVERAGE(B2:B7) return?

Hint

250 ÷ 4.

Solution

Answer: 62.5

Four numbers: (82 + 91 + 0 + 77) ÷ 4 = 250 ÷ 4 = 62.5.

4Problem

COUNT

Same cells. What does =COUNT(B2:B7) return?

Hint

Numbers only: 82, 91, 0, 77.

Solution

Answer: 4

82, 91, 0 and 77 are numbers; absent is text and one cell is empty.

5Problem

MIN

Same cells. What does =MIN(B2:B7) return?

Hint

Eli scored 0.

Solution

Answer: 0

Eli's 0 is a real number and the smallest one.

6Explore

A blank is not a zero

This is why a blank and a zero are not the same thing. A student who scored 0 pulls the average down. A student with no mark yet leaves it untouched. Microsoft's own example averages 10, 7, 9, 27 and 2 to get 11; add 5 as a second argument, =AVERAGE(A2:A6, 5), and it becomes 10, because 60 ÷ 6 = 10. And a range with no numbers at all? AVERAGE has nothing to divide by and returns #DIV/0!.

Like AVERAGE, the code keeps only numbers. An empty cell (null) changes nothing; a 0 pulls the mean down.

Scores
const cells = [82, 91, 77, null];
const nums = cells.filter((c) => typeof c === "number");
console.log(nums.reduce((a, b) => a + b, 0) / nums.length);
Output
83.33333333333333

7Problem

Blank or zero

Why does a blank score not lower the AVERAGE but a 0 does?

Hint

Which one is a number?

Solution

Answer: Empty cells are ignored; zeros are numbers and are included

A blank is omitted from both the sum and the count. A zero adds nothing to the sum but increases the count used by AVERAGE, so it can lower the mean.

8Problem

Microsoft's example

A2:A6 holds 10, 7, 9, 27, 2. What does =AVERAGE(A2:A6) return?

Hint

55 ÷ 5.

Solution

Answer: 11

55 ÷ 5 = 11, Microsoft's example.

9Problem

With 5 added

And =AVERAGE(A2:A6, 5)?

Hint

60 ÷ 6.

Solution

Answer: 10

(55 + 5) ÷ 6 = 10.

10Explain

Counting numbers, or counting filled cells

COUNT counts numbers only. Microsoft's example column holds a date, 19, 22.24, TRUE and #DIV/0!, and =COUNT(A2:A6) gives 3. The date counts, because a date is stored as a number. TRUE and the error do not. COUNTA counts every cell that isn't empty, whatever it holds, so the same column gives 5. Google's COUNTA help adds a trap worth knowing: zero-length text and spaces count too, so a cell whose formula returns "" looks blank and is still counted.

FunctionWhat it returnsText in the rangeEmpty cells
SUMtotalignoredignored
AVERAGEtotal ÷ count of numbersignoredignored
COUNThow many numbersnot countednot counted
COUNTAhow many non-empty cellscountednot counted
MIN / MAXsmallest / largest numberignoredignored

11Problem

COUNTA

Same cells. What does =COUNTA(B2:B7) return?

Hint

Every cell that is not empty.

Solution

Answer: 5

Every non-empty cell counts, including absent.

12Problem

COUNT with a date and TRUE

A column holds a date, 19, 22.24, TRUE and #DIV/0!. What does COUNT return?

Hint

A date is a number; TRUE is not.

Solution

Answer: 3

The date, 19 and 22.24 are numbers; TRUE and the error are not counted.

13Problem

AVERAGE of text only

B2:B4 holds only text. What does =AVERAGE(B2:B4) return?

Hint

Zero numbers to divide by.

Solution

Answer: #DIV/0!

No numbers means a count of 0 to divide by.

14Explain

Three kinds of middle

Is the mean always the right middle value? No. Microsoft's AVERAGE page uses 2, 3, 3, 5, 7 and 10: the mean is 5, the median (the middle value) is 4, and the mode (the most frequent value) is 3. Both programs have MEDIAN and MODE for these. When one extreme number sits in the data, like a single 0 among scores in the 80s, the median describes a typical student better than the mean does.

MeasureFormulaFor 2, 3, 3, 5, 7, 10
Mean=AVERAGE(...)5
Median (the middle value)=MEDIAN(...)4
Mode (the most frequent value)=MODE(...)3

15Problem

The median

What is the median of 2, 3, 3, 5, 7, 10?

Hint

The middle of 2, 3, 3, 5, 7, 10 is between 3 and 5.

Solution

Answer: 4

The two middle values are 3 and 5; halfway between is 4.

16Problem

The mode

What is the mode of 2, 3, 3, 5, 7, 10?

Hint

The value that appears twice.

Solution

Answer: 3

3 appears twice and every other value once, so the mode is 3.

17Explain

Argument limits and empty ranges

The two programs differ on one small point, the number of arguments a function accepts. Excel's limits page gives 255. Google's help for AVERAGE and COUNTA says Sheets takes any number. With ranges you will never notice either limit. The handling of numbers, text and blanks described above is the same in both, so a sheet built in one gives the same answers in the other.

18Problem

Arguments in Excel

How many arguments can an Excel function take?

Hint

The same limit as SUM.

Solution

Answer: 255

Excel's limits page: 255. Google Sheets accepts any number.

19Explore

Practice in the grid

MIN and MAX follow the same rule. With no numbers in the range, both return 0 instead of an error, and that 0 looks like a real result. If a price list reports a lowest price of 0, check whether there really is a free item, or whether the column simply holds no numbers.

Loading

Drag to turn. Scroll or pinch to zoom.

Dev has no score yet and Ben was absent. Try typing 70 for Dev afterwards and watch the average and both counts change.

20Practice

AVERAGE that skips text and blanks

count and countA are given. Finish average(cells): add the numbers and divide by how many numbers there are; with no numbers at all, return "#DIV/0!" like a spreadsheet.

Expected output
62.5
4
5
#DIV/0!
Your code
const isNum = (c) => typeof c === "number";
function count(cells) {
  return cells.filter(isNum).length;
}
function countA(cells) {
  return cells.filter((c) => c !== null).length;
}
function average(cells) {
  return 0;
}
const scores = [82, "absent", 91, null, 0, 77];
console.log(average(scores));
console.log(count(scores));
console.log(countA(scores));
console.log(average(["a", "b"]));
Hint

Divide by count, not by the number of cells.

A solution
const isNum = (c) => typeof c === "number";
function count(cells) {
  return cells.filter(isNum).length;
}
function countA(cells) {
  return cells.filter((c) => c !== null).length;
}
function average(cells) {
  const nums = cells.filter(isNum);
  if (nums.length === 0) return "#DIV/0!";
  return nums.reduce((a, b) => a + b, 0) / nums.length;
}
const scores = [82, "absent", 91, null, 0, 77];
console.log(average(scores));
console.log(count(scores));
console.log(countA(scores));
console.log(average(["a", "b"]));

21Explain

Common mistakes

  • Typing 0 for a test that hasn't been marked yet.

    AVERAGE counts the 0, so the average drops. Leave the cell empty until there is a real mark.

  • Using COUNT to count names or Yes answers.

    COUNT sees only numbers, so a column of text gives 0. COUNTA counts filled cells.

  • Trusting COUNTA on a column of formulas that return "".

    Google's help says zero-length text is counted, so cells that look blank still add to the total.

  • Adding cells with + when one of them holds text.

    With absent in B3, =B2+B3 gives #VALUE!, while =SUM(B2:B3) skips the text. Microsoft's #VALUE! page suggests a function such as SUM for this reason.

22

Summary

  • SUM, AVERAGE, MIN, MAX and COUNT read only the numbers in a range.
  • Empty cells are ignored; zeros are counted.
  • COUNT counts numbers; COUNTA counts every non-empty cell, even "".
  • AVERAGE of no numbers is #DIV/0!.

Next unitRounding: ROUND and what the cell shows
Full text · The whole lesson as one text

A score sheet with one absence and one missing mark

Picture the score sheet in the lab below. Ana has 82, Chloe 91, Eli 0 and Fay 77. Ben was absent, so someone typed the word absent. Dev's test hasn't been marked yet, so his cell is empty. What is the class average? Count the cells and you might divide by 6. AVERAGE divides by 4 and gets 62.5, the same answer as someone with a calculator who skips Ben and Dev.

The rule behind that answer is short. SUM adds, AVERAGE gives the arithmetic mean, MIN and MAX give the smallest and largest number, and COUNT says how many numbers there are. All five take a range such as B2:B7, or several ranges separated by commas. These functions normally ignore text and blanks in a range. COUNT also ignores error values, but SUM and AVERAGE can pass an error to their result. Microsoft's AVERAGE page puts it plainly: text, logical values and empty cells in a range are ignored, but cells with the value zero are included. Google's help says the same for Sheets. So Ben's absent and Dev's blank drop out, and Eli's 0 stays in.

This is why a blank and a zero are not the same thing. A student who scored 0 pulls the average down. A student with no mark yet leaves it untouched. Microsoft's own example averages 10, 7, 9, 27 and 2 to get 11; add 5 as a second argument, =AVERAGE(A2:A6, 5), and it becomes 10, because 60 ÷ 6 = 10. And a range with no numbers at all? AVERAGE has nothing to divide by and returns #DIV/0!.

Counting numbers, or counting filled cells

COUNT counts numbers only. Microsoft's example column holds a date, 19, 22.24, TRUE and #DIV/0!, and =COUNT(A2:A6) gives 3. The date counts, because a date is stored as a number. TRUE and the error do not. COUNTA counts every cell that isn't empty, whatever it holds, so the same column gives 5. Google's COUNTA help adds a trap worth knowing: zero-length text and spaces count too, so a cell whose formula returns "" looks blank and is still counted.

FunctionWhat it returnsText in the rangeEmpty cells
SUMtotalignoredignored
AVERAGEtotal ÷ count of numbersignoredignored
COUNThow many numbersnot countednot counted
COUNTAhow many non-empty cellscountednot counted
MIN / MAXsmallest / largest numberignoredignored

Is the mean always the right middle value? No. Microsoft's AVERAGE page uses 2, 3, 3, 5, 7 and 10: the mean is 5, the median (the middle value) is 4, and the mode (the most frequent value) is 3. Both programs have MEDIAN and MODE for these. When one extreme number sits in the data, like a single 0 among scores in the 80s, the median describes a typical student better than the mean does.

The two programs differ on one small point, the number of arguments a function accepts. Excel's limits page gives 255. Google's help for AVERAGE and COUNTA says Sheets takes any number. With ranges you will never notice either limit. The handling of numbers, text and blanks described above is the same in both, so a sheet built in one gives the same answers in the other.

MIN and MAX follow the same rule. With no numbers in the range, both return 0 instead of an error, and that 0 looks like a real result. If a price list reports a lowest price of 0, check whether there really is a free item, or whether the column simply holds no numbers.

Dev has no score yet and Ben was absent. Try typing 70 for Dev afterwards and watch the average and both counts change.
Common mistakes
  • Typing 0 for a test that hasn't been marked yet. AVERAGE counts the 0, so the average drops. Leave the cell empty until there is a real mark.
  • Using COUNT to count names or Yes answers. COUNT sees only numbers, so a column of text gives 0. COUNTA counts filled cells.
  • Trusting COUNTA on a column of formulas that return "". Google's help says zero-length text is counted, so cells that look blank still add to the total.
  • Adding cells with + when one of them holds text. With absent in B3, =B2+B3 gives #VALUE!, while =SUM(B2:B3) skips the text. Microsoft's #VALUE! page suggests a function such as SUM for this reason.
Teacher's noteThe idea that trips people up is that a blank and a 0 are different data, not two ways of writing nothing. Have learners guess the average before they type the formula, then fill in Dev's score and watch AVERAGE, COUNT and COUNTA move together. One habit worth passing on: while checking a sheet, put =COUNT(...) right next to every =AVERAGE(...). The count tells you how many values the average really used. Bring in the median once the blank-versus-zero idea has settled.

Three kinds of middle

MeasureFormulaFor 2, 3, 3, 5, 7, 10
Mean=AVERAGE(...)5
Median (the middle value)=MEDIAN(...)4
Mode (the most frequent value)=MODE(...)3
Key points
  • SUM, AVERAGE, MIN, MAX and COUNT read only the numbers in a range.
  • Empty cells are ignored; zeros are counted.
  • COUNT counts numbers; COUNTA counts every non-empty cell, even "".
  • AVERAGE of no numbers is #DIV/0!.

Practice questions from SUM, AVERAGE, COUNT, MIN and MAX on edubun

Embed this quiz

Free to embed. Please keep the credit line.

Sources for this course (19)
  • Microsoft Support, "Switch between relative, absolute, and mixed references" (support.microsoft.com/en-us/office/dfec08cd-ae65-4f56-839e-5f0d8d0baca9: $ before column and row, F4 to switch, copying two down and two right: $A$1 stays, A$1 to C$1, $A1 to $A3, A1 to C3)
  • Microsoft Support, "AVERAGE function" (support.microsoft.com/en-us/office/047bac88-d466-426c-a32b-8f33eb960cf6: text, logical values and empty cells in a reference ignored, zeros included; 10, 7, 9, 27, 2 gives 11, with 5 gives 10; mean 5, median 4, mode 3 for 2 3 3 5 7 10)
  • Microsoft Support, "COUNT function" (support.microsoft.com/en-us/office/a59cd7fc-b623-4d93-87a4-d23bf411294c: only numbers counted, dates count, errors and text do not)
  • Microsoft Support, "ROUND function" (support.microsoft.com/en-us/office/c018c5d8-40fb-4053-90b1-b3e7f61a213c: num_digits required; 2.15 to 2.2, -1.475 to -1.48, 626.3 to 1000, 1.98 to 0, -50.55 to -100)
  • Microsoft Support, "IF function" (support.microsoft.com/en-us/office/69aed7c9-4e8a-4755-a9bc-aa8bbff73be2: value_if_false optional, text in quotes except TRUE and FALSE, 0 and #NAME? problems)
  • Microsoft Support, "VLOOKUP function" (support.microsoft.com/en-us/office/0bbc8083-26fe-4963-8ab8-93a18ad188a1: range_lookup TRUE by default, sorted first column, #N/A, #REF!, #VALUE!, absolute table range, wildcards with FALSE)
  • Microsoft Support, "XLOOKUP function" (support.microsoft.com/en-us/office/b7fd680e-6d10-43e6-84f9-88eae8bf5929: not in Excel 2016 and Excel 2019, exact match by default)
  • Microsoft Support, "How to correct a #VALUE! error" (support.microsoft.com/en-us/office/15e1b616-fbf2-4147-9c0b-0a11a20e409e: + and * may not calculate cells with text, use SUM instead, IFERROR hides all errors)
  • Microsoft Support, "Excel specifications and limits" (15 digits, 64 nested levels, 255 arguments)
  • Google Docs Editors Help, "VLOOKUP" (support.google.com/docs/answer/3093318: is_sorted TRUE by default, FALSE recommended, search down to a larger value, " Apple" and "Apple " differ, wildcards, IFNA, absolute range)
  • Google Docs Editors Help, "XLOOKUP" (support.google.com/docs/answer/12405947)
  • Google Docs Editors Help, "ROUND" (support.google.com/docs/answer/3093440: places optional, 0 by default, rounding by magnitude)
  • Google Docs Editors Help, "IF" (support.google.com/docs/answer/3093364: order of the answers is the most common problem, IFS)
  • Google Docs Editors Help, "AVERAGE" (support.google.com/docs/answer/3093615: text ignored, any number of arguments)
  • Google Docs Editors Help, "COUNTA" (support.google.com/docs/answer/3093991: zero-length strings and spaces count)
  • Google Docs Editors Help, "Keyboard shortcuts for Google Sheets" (support.google.com/docs/answer/181110: F4 and Fn+F4 while entering a formula, F4 as Redo)
  • Pryor Learning and Exceljet (F4 cycle A1, $A$1, A$1, $A1; = comparison not case-sensitive)
  • Ablebits (IF without value_if_false returns FALSE)
  • Spreadsheet Class (Sheets circular dependency shows #REF!)

Checked: 2026-10-19