Unit 3.2: Formulas and Functions I

--:-- --
↓ Scroll for more

Unit 3.2

Formulas and Functions I

PRC 110: Software Skills Practicum

📖 Read the full note

1979: the spreadsheet that sold computers ran here

An Apple II Plus. Stand-in: the 1979 machine VisiCalc ran on; VisiCalc itself is not on screen (no free image exists)

Learning Objectives

  • Write formulas starting with =.
  • Use SUM, AVERAGE, MAX, MIN, COUNT.
  • Use basic Text & Date functions.

Anatomy of a Formula

All formulas start with =.

  • + - * / ^
  • Example: =(A1+B1)*0.1

Order of Operations

Excel calculates ( ) → ^ → * / → + −, left to right within a level.

Quick poll: predict the answer before anyone types it.

  • =2+3*4 → 14 (multiply first)
  • =(2+3)*4 → 20 (brackets first)
  • =2*3^2 → 18 (power first)
  • =100-20/4 → 95

Trap: =-2^2 gives 4, because Excel applies the minus sign before the power. Write =-(2^2) to get −4.

Check: Formula Basics

Ask a student or group first — then click to check.

Hands-on: Your First Formulas

Open student_grades.csv: A = ID, B = Name, C–F = Math, Science, English, History.

  1. Type Total in G1 and =C2+D2+E2+F2 in G2. → Aarav: 296
  2. Replace G2 with =SUM(C2:F2). → still 296, shorter and safer.
  3. Double-click the fill handle (small square at G2's bottom-right). → G10 Neha 318; G6 Priya 254.
  4. Click G5 and read the formula bar. → =SUM(C5:F5): the row number moved with the copy.

Save as Excel Workbook (.xlsx): a CSV keeps only the values, not your formulas or formatting.

Relative vs Absolute References

Relative: J1

Shifts when copied. One row down, J1 becomes J2.

Absolute: $J$1

Locked. It stays $J$1 wherever you copy it.

Put a bonus of 5% in J1. In H2: =G2*(1+$J$1), fill down. → Aarav 310.8

Without $, H3 becomes =G3*(1+J2). J2 is empty, so Sita gets 307 with no bonus and no error message.

Shortcut: put the cursor on a reference and press F4 to cycle J1 → $J$1 → J$1 → $J1.

Fill down

Custom diagram: fill down: =B2*$F$1 copied to rows 3–5, relative part moves, $F$1 stays (13% VAT)

🎬 Watch: The Copy-Down That Breaks, and the $ That Fixes It

Essential Functions

  • =SUM(A1:A10)
  • =AVERAGE(A1:A10)
  • =MAX / =MIN
  • =COUNT(A1:A10)

Text & Date

  • UPPER / LOWER / PROPER
  • CONCAT or &
  • TODAY() / DATEDIF

Hands-on: Class Statistics

Same file. Type the labels Average, Highest, Lowest, Count in B13:B16.

  1. C13 =AVERAGE(C2:C11) → Math average 70.2
  2. C14 =MAX(C2:C11), C15 =MIN(C2:C11) → 97 and 46
  3. C16 =COUNT(C2:C11) → 10 students
  4. Select C13:C16 and drag the fill handle right to F. → Science average 76.8; History lowest 45

Faster: Home → AutoSum (Σ) drop-down → Average / Max / Min. Or just select a range and read the status bar.

Quick Poll: Which Count?

In C2:C11, eight students have marks, Rohan's cell says Absent, and Karan's cell is blank.

  • =COUNT(C2:C11) → 8 (numbers only)
  • =COUNTA(C2:C11) → 9 (anything not empty)
  • =COUNTBLANK(C2:C11) → 1
  • =AVERAGE(C2:C11) → averages the 8 numbers; text and blanks are ignored

Discuss: should "Absent" count as 0? Who decides, and how would you show it in the sheet?

Class register

Custom diagram: class register (fictional): COUNT 8, COUNTA 9, COUNTBLANK 1

Check: Which Function?

Ask a student or group first — then click to check.

Hands-on: Text Functions

  1. I2 =UPPER(B2) → AARAV
  2. J2 =B2&" ("&A2&")" → Aarav (S101)
  3. K2 =CONCAT(B2,"-",A2) → Aarav-S101
  4. L2 =LEN(B2) → 5 characters
  5. M2: type S101 Aarav by hand, go to M3, press Ctrl+E (Flash Fill). → M3 S102 Sita, and so on down

=PROPER("ram BAHADUR") → Ram Bahadur: handy for names typed in mixed case.

Dates Are Numbers in Disguise

  • Excel stores a date as a serial number (day 1 = 1 Jan 1900). Format a date cell as General to see it.
  • Days to year-end: =DATE(2026,12,31)-TODAY()
  • Age from a birth date in B2: =DATEDIF(B2,TODAY(),"Y"). DATEDIF does not appear in autocomplete, so type it in full.

Real case: Excel kept turning gene names such as SEPT2 and MARCH1 into dates in research data. In 2019–20 the gene naming committee (HGNC) renamed them SEPTIN2 and MARCHF1.

Discuss: Nepal's official dates use Bikram Sambat, but Excel's date functions use the AD calendar. How would you store a BS date?

Gene names like SEPT1 turned into dates

A genome researcher pipetting DNA samples

Reading Excel's Error Messages

You seeUsual causeExample
#DIV/0!Dividing by 0 or by an empty cell=G2/Z1
#NAME?Misspelt function or name=SUMM(C2:F2)
#VALUE!Text used in arithmetic=B2+1 (B2 is a name)
#REF!A referenced cell was deletedDelete a column a formula used
#####Column too narrow (not an error)Widen the column

Press Ctrl+` (the key left of 1) to show every formula instead of its result; press again to switch back.

Real Case: One Wrong Range

  • 2010: Harvard economists Reinhart and Rogoff publish "Growth in a Time of Debt". It is widely quoted in debates about government spending cuts.
  • 2013: Graduate student Thomas Herndon gets their spreadsheet and finds an AVERAGE range that left out five countries' rows, along with other data choices.
  • With everything corrected, average growth in high-debt countries was about +2.2%, not the −0.1% reported.

Pair discussion (1 min): list three checks that would have caught it.

→ Click the cell and check the coloured range · compare COUNT of the range to the rows you expect · Ctrl+` review · let a classmate re-check.

🎬 Watch: Five Rows Left Out

Reinhart & Rogoff, 2010

Economist Carmen Reinhart, co-author of the 2010 paper

Practicum 3.2

Grade calculation

Use student_grades.csv:

  1. SUM total marks; AVERAGE; MAX; MIN.
  2. Optional: PROPER on names; TODAY() in a header cell.

Exit Ticket: Predict the Result

Write your answers on paper first, then reveal.

  1. =10/4 → 2.5
  2. =2^3*2 → 16
  3. =MAX(3,9,2)+MIN(3,9,2) → 11
  4. =COUNT(1,"two",3) → 2 (text is not counted)
  5. =PROPER("kathmandu valley") → Kathmandu Valley

5/5 = ready for Unit 3.3 (IF and VLOOKUP). Under 3? Redo N2–N4 before next lab.

Credits

  • Image: Apple II Plus — Akbkuku, CC BY 4.0, via Wikimedia Commons (source)
  • Image: fill down: =B2*$F$1 copied to rows 3–5, relative part moves, $F$1 stays (13% VAT) — Made for PRC 110, CC BY 4.0
  • Image: class register (fictional): COUNT 8, COUNTA 9, COUNTBLANK 1 — Made for PRC 110, CC BY 4.0
  • Image: NHGRI researcher with pipette (Maggie Bartlett, NHGRI) — Maggie Bartlett, NHGRI, Public domain, via Wikimedia Commons (source)
  • Image: Carmen M. Reinhart — World Economic Forum from Cologny, Switzerland, CC BY-SA 2.0, via Wikimedia Commons (source)
  • Video: Relative vs Absolute Cell Reference in Microsoft Excel — Teacher's Tech, YouTube 8XXoHeCWzgU, 2:12–3:41
  • Video: One Excel Error Crashed Entire Economies — Economies of History, YouTube ykGJU0gJWlA, 2:28–3:27
  • Sample data: student_grades.csv — PRC 110 sample pack

Thank You

Questions? Save your workbook as .xlsx and bring it to the next lab.

PRC 110: Software Skills Practicum · Unit 3.2