📊 Formuły i adresowanie względne w arkuszu kalkulacyjnym

Materiał edukacyjny – klasa 8 (dwujęzyczna), 1 godzina lekcyjna

Budowa arkusza Formuły Adresowanie względne

1 Budowa arkusza kalkulacyjnego

Arkusz kalkulacyjny pozwala tworzyć dokumenty w postaci tabel. Umieszczamy w nich dane, na których możemy wykonywać obliczenia (np. finansowe, matematyczne, statystyczne) oraz porządkowanie (np. filtrowanie, sortowanie). Najbardziej znanym arkuszem kalkulacyjnym jest program Microsoft Excel – podobne możliwości mają też LibreOffice Calc i Arkusze Google.

Dokument arkusza kalkulacyjnego nazywamy skoroszytem. Skoroszyt składa się z arkuszy. Każdy arkusz jest tabelą zbudowaną z wierszy i kolumn. Pole powstające na przecięciu wiersza i kolumny nazywamy komórką.

Każda komórka ma swój adres, który określa jej położenie w dokumencie. Adres składa się z litery oznaczającej kolumnę i liczby naturalnej oznaczającej numer wiersza, np. A4, F10. Adres może też określać zakres komórek – np. A4:A20 oznacza komórki w kolumnie A od wiersza 4 do 20, a B2:K2 – komórki w wierszu 2, od kolumny B do kolumny K.

Krótkie ćwiczenie: Jaki zakres komórek opisuje adres C3:F10?

2 Obliczenia w arkuszu – formuły

Formuła w arkuszu kalkulacyjnym to wyrażenie (np. działanie matematyczne) zapisane za pomocą operatorów i funkcji dostępnych w programie.

ZasadaOperatorPrzykład
formułę zaczynamy od znaku równości==A1+B1
używamy standardowych symboli dodawania i odejmowania+ / −=A1+A2+1
mnożenie, dzielenie i potęgowanie zastępujemy odpowiednimi znakami* / / / ^=G5*2, =F7/3, =D6^2
stosujemy wyłącznie nawiasy okrągłe( )=(A1+B1)*(2+2*(C1-D1))

W formułach zaleca się używać adresów komórek, a nie konkretnych wpisanych wartości – dzięki temu zmiana danych w komórce powoduje automatyczne przeliczenie wyniku każdej formuły, która się do niej odwołuje.

Ćwiczenie 1: Utwórz nowy plik arkusza kalkulacyjnego. Do komórki A2 wpisz liczbę 3489, a do komórki B2 – liczbę 89752. W komórce C2 umieść formułę obliczającą sumę tych dwóch liczb, korzystając z adresów komórek. Zmień kilka razy zawartość komórek A2 i B2 i zwróć uwagę na to, co dzieje się w komórce C2.

3 Adresowanie względne

Zaletą arkusza jest to, że nie trzeba przepisywać tej samej formuły wiele razy. Zapisaną w komórce formułę można skopiować, a następnie wkleić do komórek, w których chcemy wykonać te same obliczenia dla innych danych.

Praca w arkuszu kalkulacyjnym opiera się na adresowaniu względnym, ułatwiającym wykonywanie powtarzających się obliczeń, ponieważ podczas kopiowania formuł automatycznie zmieniają się odwołania do wierszy i kolumn – zgodnie z kierunkiem kopiowania (przy kopiowaniu w pionie zmieniają się numery wierszy, a przy kopiowaniu w poziomie – litery kolumn).

Przykład: formuła =A2+B2 zapisana w komórce C2, po skopiowaniu do komórki C3 zmienia się na =A3+B3 – zmienił się numer wiersza (z 2 na 3), a litery kolumn pozostały bez zmian.

Ćwiczenie 2 (adresowanie względne): Do kolumny A wpisz pięć liczb zaczynając od komórki A1, a do kolumny B – pięć liczb zaczynając od komórki B2. Do komórki C3 wpisz formułę obliczającą średnią arytmetyczną liczb z komórek A1 i B2. Skopiuj formułę z komórki C3 do komórek C4:C7. Wyjaśnij, dlaczego w komórce C7 formuła ma postać =(A5+B6)/2 – uwzględnij w wyjaśnieniu położenie komórek, których adresy występują w formule zawartej w komórce C3, względem tej komórki.

4 Ćwiczenie praktyczne: analiza wydatków

Poniższe ćwiczenie łączy adresowanie względne z podstawowymi funkcjami arkusza kalkulacyjnego: SUMA, ŚREDNIA, MAX i MIN.

Ćwiczenie 3 (analiza wydatków):
  1. Utwórz nowy arkusz z kolumnami: A – Kategoria, B – Wydatki w styczniu, C – Wydatki w lutym. Wpisz 6 kategorii (np. jedzenie, transport, rozrywka, ubrania, rachunki, inne) oraz przykładowe kwoty w obu miesiącach (wiersze 2–7).
  2. W komórce D2 wpisz formułę obliczającą różnicę wydatków między lutym a styczniem: =C2-B2. Skopiuj tę formułę do komórek D3:D7 i zaobserwuj, jak zmieniają się w niej adresy komórek.
  3. Poniżej tabeli oblicz: łączną sumę wydatków w lutym – =SUMA(C2:C7), średnią wydatków w lutym – =ŚREDNIA(C2:C7), kategorię o najwyższym wydatku – =MAX(C2:C7) oraz o najniższym – =MIN(C2:C7).
  4. Na podstawie kolumny D wskaż, w której kategorii wydatki wzrosły najbardziej, a w której najbardziej zmalały. Zapisz plik pod nazwą Analiza wydatków.

! Zapamiętaj

  • Dokument arkusza kalkulacyjnego nazywamy skoroszytem; składa się on z arkuszy zbudowanych z wierszy i kolumn.
  • Adres komórki to litera kolumny i numer wiersza, np. A4; adres może też opisywać zakres komórek, np. A4:A20.
  • Formułę zawsze zaczynamy od znaku =.
  • W formułach należy używać adresów komórek, a nie wpisanych na sztywno wartości.
  • Podczas kopiowania formuły adresy komórek zmieniają się automatycznie zgodnie z kierunkiem kopiowania – to właśnie adresowanie względne.
  • Funkcje SUMA, ŚREDNIA, MAX i MIN pozwalają szybko podsumować dane z zakresu komórek.

✓ Podsumowanie – test końcowy

Sprawdź swoją wiedzę z całej lekcji. Odpowiedź jest liczona tylko przy pierwszej próbie. Żeby przejść dalej, musisz trafić poprawną odpowiedź.

Pytanie 1/15 • Wynik: 0/0

📊 Formulas and relative addressing in a spreadsheet

Educational material – grade 8 (bilingual class), 1 lesson (45 minutes)

Spreadsheet structure Formulas Relative addressing

1 The structure of a spreadsheet

A spreadsheet allows you to create documents in the form of tables. We place data in them and can perform calculations on it (e.g. financial, mathematical, statistical) as well as organise it (e.g. filtering, sorting). The best-known spreadsheet program is Microsoft Excel – LibreOffice Calc and Google Sheets offer similar features.

A spreadsheet document is called a workbook. A workbook is made up of worksheets. Each worksheet is a table made up of rows and columns. The field created where a row and a column meet is called a cell.

Every cell has its own address, which determines its position in the document. An address consists of a letter denoting the column and a natural number denoting the row, e.g. A4, F10. An address can also describe a range of cells – e.g. A4:A20 means the cells in column A from row 4 to row 20, and B2:K2 means the cells in row 2, from column B to column K.

Short exercise: Which range of cells is described by the address C3:F10?

2 Calculations in a spreadsheet – formulas

A formula in a spreadsheet is an expression (e.g. a mathematical operation) written using the operators and functions available in the program.

RuleOperatorExample
a formula always starts with an equals sign==A1+B1
we use the standard symbols for addition and subtraction+ / −=A1+A2+1
multiplication, division and exponentiation are written with these symbols* / / / ^=G5*2, =F7/3, =D6^2
only round brackets are used( )=(A1+B1)*(2+2*(C1-D1))

In formulas, it is recommended to use cell addresses rather than fixed values typed directly in – this way, changing the data in a cell automatically recalculates the result of every formula that refers to it.

Exercise 1: Create a new spreadsheet file. Type the number 3489 into cell A2 and the number 89752 into cell B2. In cell C2, enter a formula that calculates the sum of these two numbers using cell addresses. Change the contents of cells A2 and B2 a few times and observe what happens in cell C2.

3 Relative addressing

The advantage of a spreadsheet is that you don't need to rewrite the same formula many times. A formula written in a cell can be copied and then pasted into other cells where you want to perform the same calculations on different data.

Working in a spreadsheet is based on relative addressing, which makes repetitive calculations easier, because when formulas are copied, the references to rows and columns change automatically – according to the direction of copying (copying vertically changes the row numbers, while copying horizontally changes the column letters).

Example: the formula =A2+B2 written in cell C2, once copied into cell C3, becomes =A3+B3 – the row number changed (from 2 to 3), while the column letters stayed the same.

Exercise 2 (relative addressing): In column A, enter five numbers starting from cell A1, and in column B, five numbers starting from cell B2. In cell C3, enter a formula that calculates the arithmetic mean of the numbers in cells A1 and B2. Copy the formula from cell C3 into cells C4:C7. Explain why, in cell C7, the formula takes the form =(A5+B6)/2 – in your explanation, refer to the position of the cells whose addresses appear in the formula in cell C3, relative to that cell.

4 Practical exercise: expense analysis

This exercise combines relative addressing with the basic spreadsheet functions: SUM, AVERAGE, MAX and MIN.

Exercise 3 (expense analysis):
  1. Create a new spreadsheet with the columns: A – Category, B – January expenses, C – February expenses. Enter 6 categories (e.g. food, transport, entertainment, clothes, bills, other) and sample amounts for both months (rows 2–7).
  2. In cell D2, enter a formula that calculates the difference between February and January expenses: =C2-B2. Copy this formula into cells D3:D7 and observe how the cell addresses in it change.
  3. Below the table, calculate: the total February expenses – =SUM(C2:C7), the average February expense – =AVERAGE(C2:C7), the category with the highest expense – =MAX(C2:C7), and the lowest – =MIN(C2:C7).
  4. Based on column D, identify in which category expenses increased the most, and in which they decreased the most. Save the file as Expense analysis.

! Remember

  • A spreadsheet document is called a workbook; it is made up of worksheets built from rows and columns.
  • A cell address consists of a column letter and a row number, e.g. A4; an address can also describe a range of cells, e.g. A4:A20.
  • A formula always starts with an = sign.
  • Formulas should use cell addresses rather than fixed values typed directly in.
  • When a formula is copied, cell addresses change automatically according to the direction of copying – this is called relative addressing.
  • The SUM, AVERAGE, MAX and MIN functions let you quickly summarise data from a range of cells.

✓ Summary – final quiz

Test your knowledge of the whole lesson. An answer only counts on the first attempt. To move on, you need to select the correct answer.

Question 1/15 • Score: 0/0