Wize Management Information Systems Textbook > Spreadsheet Analysis with Excel

Statistical Functions and Conditional Formatting in Excel

Summarizing Data with Spreadsheet Statistical Functions

A column of 500 sales figures tells a manager very little until it is reduced to a few numbers: the total, the typical value, the extremes and how many entries meet a target. Spreadsheet statistical functions do that reduction, and conditional formatting puts the result back on the sheet by colouring the cells that matter. You will use both whenever you summarize operational, financial or survey data in a business information system.

The core summary functions

A statistical function takes a range such as B2:B50 and returns one value that describes it. The functions below cover most routine summaries.


Function

What it returns

How it treats text and empty cells

SUM(range)

Total of the numbers

Ignored

AVERAGE(range)

Arithmetic mean of the numbers

Ignored

MEDIAN(range)

Middle number after sorting; the mean of the two middle numbers when the count is even

Ignored

MIN(range), MAX(range)

Smallest and largest number

Ignored

COUNT(range)

How many cells hold numbers

Not counted

COUNTA(range)

How many cells are not empty

Text counted, empty cells not

COUNTBLANK(range)

How many cells are empty

Only empty cells counted


AVERAGE is SUM divided by COUNT over the same range:


AVERAGE(r)=SUM(r)COUNT(r)\text{AVERAGE}(r) = \frac{\text{SUM}(r)}{\text{COUNT}(r)}


The mean and median answer different questions. One unusually large value pulls the mean towards it but barely moves the median, so report the median when a few extreme values would distort the typical case, as with salaries or delivery delays. Dates and times are stored as numbers, so COUNT, MIN and MAX work on them too: MAX of a date column returns the latest date.



Blanks, zeros and text

An empty cell and a cell containing 0 look similar but behave differently. A zero is a number, so it enters COUNT and pulls AVERAGE down; an empty cell is skipped entirely. Text such as n/a is also skipped by every function in the table except COUNTA.


Example: Four cells hold 40, 0, 50 and nothing. AVERAGE divides the sum 90 by the three numbers and returns 30. If the 0 is deleted, the same formula divides 90 by two and returns 45.



Counting with one condition: COUNTIF

COUNTIF(range, criterion) counts the cells in a range that pass one test, the criterion.

  • =COUNTIF(C2:C40,">=100") counts values of 100 or more.
  • =COUNTIF(D2:D40,"Late") counts cells whose text is Late, ignoring case.
  • =COUNTIF(C2:C40,">"&F1) joins the operator to the value in F1, so the threshold can change without editing the formula.

The comparison operator sits inside the quotation marks. A strict test such as ">100" excludes a cell holding exactly 100, so check whether your target is inclusive. Counting with several conditions at once needs other functions and is a separate topic.

Flagging values with conditional formatting

Conditional formatting changes a cell's fill, font or icon automatically when the cell meets a rule, and updates as the data changes. You first select the cells, the Applies to range, then choose a rule:

  • Highlight Cells Rules compare each value with a fixed number or text, such as greater than 100.
  • Top/Bottom Rules flag the top 10 items, the bottom 10% or values above the average of the range.
  • Data Bars and Color Scales shade every cell in proportion to its value.
  • Use a formula applies any test that returns TRUE or FALSE.

A formula rule is written for the top-left cell of the Applies to range, and the spreadsheet copies it to every other cell exactly as it would copy a formula down a column. Relative references therefore shift. To compare each cell in B2:B30 with the average of the whole column, write =B2>AVERAGE($B$2:$B$30): B2 shifts to B3, B4 and so on, while the dollar signs keep the averaged range fixed.



What to remember

  • SUM, AVERAGE, MEDIAN, MIN, MAX and COUNT use numbers only; COUNTA also counts text.
  • A zero counts in AVERAGE; an empty cell does not.
  • Prefer MEDIAN when extreme values would distort the mean.
  • COUNTIF takes one criterion in quotes; ">" is strict and ">=" is inclusive.
  • Formula-based formatting rules are written for the top-left cell; anchor a shared range with dollar signs.

Example: Summarizing one shift's delivery times

A dispatcher logs each order's delivery time, in minutes, in cells B2:B9. One order has not been recorded yet, so B5 is empty, and one driver's scanner failed, so B8 holds the text late scan.


Cell

Entry

B2

28

B3

35

B4

22

B5

(empty)

B6

41

B7

30

B8

late scan

B9

26


a) What does =AVERAGE(B2:B9) return, to one decimal place?


AVERAGE uses only the cells that hold numbers. The empty cell B5 and the text in B8 are skipped, leaving 28, 35, 22, 41, 30 and 26.


The numbers sum to ________, and COUNT finds ________ numeric cells. Dividing:


AVERAGE=1826=30.33 min≈30.3 min\text{AVERAGE} = \frac{182}{6} = 30.33\ \text{min} \approx 30.3\ \text{min}


Dividing by all eight cells instead would give 22.75 minutes, a result the spreadsheet never produces here because empty and text cells are not counted.


b) What does =MEDIAN(B2:B9) return?


MEDIAN also ignores the empty and text cells. Sort the six numbers: 22, 26, 28, 30, 35, 41.


With an even count there is no single middle value, so MEDIAN averages the two middle numbers, ________ and ________:


MEDIAN=28+302=29 min\text{MEDIAN} = \frac{28 + 30}{2} = 29\ \text{min}


The median is slightly below the mean of 30.3 minutes because the 41-minute delivery pulls the mean upward.


c) The company promises delivery within 30 minutes. What does =COUNTIF(B2:B9,">30") return, and what does it measure?


The criterion ">30" counts numeric cells strictly greater than 30. Checking each entry, only ________ pass. The 30 in B7 fails because the test is strict, and the empty cell and the text entry fail because they are not numbers above 30.


The formula returns 2: two orders missed the promise. The matching count of on-time orders is =COUNTIF(B2:B9,"<=30"), which returns 4 (22, 26, 28 and 30).


d) The dispatcher selects B2:B9 and applies the built-in Top/Bottom rule Above Average with a light red fill. Which cells are shaded?


The Above Average rule compares each number in the selection with the mean of the numbers in that selection, which part (a) found to be ________ minutes.


Going down the column: 28 is below, 35 is above, 22 is below, 41 is above, 30 is below and 26 is below. The empty cell and the text entry are not numbers, so the rule does not shade them.


The shaded cells are B3 (35 minutes) and B6 (41 minutes). If the missing time in B5 is later entered, the average changes and the rule re-evaluates every cell automatically.

A range of cells contains numbers, a few text labels and some empty cells. Match each spreadsheet function with the value it returns when applied to that range.

Match each term
A.

Largest numeric entry

B.

Number of cells holding numeric entries

C.

Middle numeric entry after sorting, or the mean of the two middle entries

D.

Number of non-empty cells, text entries included

E.

Total of the numeric entries

F.

Arithmetic mean of the numeric entries

SUM

AVERAGE

COUNTA

MAX

COUNT

MEDIAN

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

Cells A2:A7 of an inventory sheet hold, in order: 12, the text pending, an empty cell, 0, 8 and 15. What value does the formula =AVERAGE(A2:A7) return?

Choose an answer

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

An instructor records quiz scores out of 100 in cells C2:C9. One student has not yet taken the quiz, so C4 is empty, and another was marked with the text absent.


Cell

Entry

C2

72

C3

85

C4

(empty)

C5

64

C6

absent

C7

90

C8

85

C9

58


The instructor enters these formulas elsewhere on the sheet:

  • =SUM(C2:C9)
  • =MEDIAN(C2:C9)
  • =COUNT(C2:C9)
  • =COUNTA(C2:C9)
  • =COUNTIF(C2:C9,">=85")

Enter the value each formula returns. Give exact values, using a decimal only where the result is not a whole number.

FormulaResult
SUM
MEDIAN
COUNT
COUNTA
COUNTIF at least 85

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors