Table of contents:
- Packing with circles: simple mathematical functions
- Analysis of triangular surface: importing data, simple functions, conditional formatting
- Practice: Solving a quadratic equation: simple functions
Introduction
Excel has many built-in functions that make our work easier. In general the functions have input data, on which it performs some operation and determines an output, which the program displays in the given cell. Functions can also be combined with each other.
Example: The rules can be read from the illustration. If you write a function in a cell, it must start with "=". The name of the function should be followed by the input parameters in parentheses, separated by semicolons (or commas, depending on your computer's settings). The result is displayed in the cell. To view the function, click once or twice on the cell. You can edit the contents of the cell in the formula bar or in the cell itself. The input parameter of the SUM() function one or more ranges and the final result is the sum of all the numbers in the range. In the example we have given two ranges (one cell each), but we could also have written =SUM(B1:B2).
You don't need to learn the order of the functions input data, as soon as you start typing the function's name, the program displays a hint to help you know what parameters to enter. It also indicates where you are in the function by the colour of the parameter.
HINT: If something doesn't work, or it's not clear how to use a function, you may want to use Excel's help. With a simple internet search we can find in one of the first results the Microsoft website, where we will find detailed explanations illustrated with examples.
Simple mathematical functions:
- SIN(), COS(): input angle has to be given in radians, it returns the sine/cosine value
- ASIN(), ACOS(): arcus sine/cosine
- PI(): returns the value of 𝛑 (but "only" 15 digits), no input parameters!
- SQRT() (GYOK()): square root
- RADIANS() (RADIÁN()): degrees to radians conversion
- DEGREES() (SZÖG()): conversion from radian to degree
HINT: Finctions can be combined, nested (pl. =SIN(PI())) or we can add them together (pl. =SIN(PI())+COS(PI()).
Simpler aggregation functions:
- SUM() (SZUM()): summary
- AVERAGE() (ÁTLAG()): average
- COUNT() (DARAB()): number of cells containing numbers
- MIN(), MAX(): minimum, maximum value
Troubleshooting. When using formulas and functions, it is very important that only values that are perfectly accurate and conform to the rules can be interpreted by the program. If it finds an error, it will help you find the problem by displaying various error messages.
- ######: data does not fit in the cell, increasing the cell size solves the problem
- #DIV/0!: division by zero
- #N/A: incorrect reference
- #NAME?: function with unknown name (e.g. typo)
- #REF!: this error message usually appears when you subsequently delete a cell referenced by the formula
HINT: Error messages can be quickly decrypted with a simple web search . The first results will tell you where to look for the error.
In the following exercises, the above functions should be used. In case of an error, try to check if the syntax was correct and interpret the error message.
1. Packing with circles
Excercise: on a sheet of A4 paper, draw circles that can touch each other. Calculate the number of circles that fit on the sheet for a given radius and the useful area in %.
First enter the dimensions of the A4 sheet in the table and calculate its area.
- find the size of the sheet on the internet
- in cell A1 enter "A4 height", in cell B1 enter the longer size
- in cell A2 enter "A4 width", in cell B2 enter the shorter size
- write "A4 area" in cell A3 and calculate the area in cell B3:
=B1*B2
Then you need a cell to specify the radius of the circle. From the radius, you can calculate the area and how many pieces are horizontally and vertically on the sheet.
- in cell A5 write "radius of circle", in cell B5 enter a number of your choice
- in cell A6 write "area of circle", in cell B6 calculate the area of the circle:
=B5^2*PI()
- in cell A7 write "pieces horizontally", in cell B7 calculate the number of pieces horizontally (width/(2*beam)):
=B2/(2*B5)
- in cell A8, write "pieces vertically", in cell B8, calculate the number of pieces vertically (height/(2*radius)):
=B1/(2*B5)
In general, the number of items is not a whole number, and must be rounded down. In the introduction, there was no mention of a function that rounds, so you have to look it up on the Internet.
- let's search for the needed function on the internet
- modify the formula for the number of items using the function found
The number of circles is obtained by multiplying the horizontal and vertical number of items. The useful area is the total area of the circles divided by the area of the A4 sheet.
Click on the

button to display the result as a percentage.
- write "total" in cell A10 and calculate the number of pieces in cell B10:
=B7*B8
- write "useful area" in cell A11 and calculate the useful area in cell B11:
=B10*B6/B3
- display the useful area in %
- set units of measurement for the other cells too
You can compare your solution with the solution key.
2. Analysis of triangular surface
Project subject 2022 | Design: Ther Tamás
Excercise: TWe designed a structure made up of triangles as shown in the illustration. The design was created with a CAD program, which assigned a number to the triangles and extracted the side lengths of each of them into the triangles.csv file. We would like to make the design out of paper, but we need to reinforce where the triangles connect with tape and the angles less than 20° with a small metal element!
Calculate:
- how much paper will we need?
- approximately how much tape will we need?
- what are the angles of the triangles?
- what is the average size of the triangles planned?
- how many triangles are there?
We want to make building the model easier and mark the angles to be reinforced. Use conditional formatting!
First download the CSV file, then import it with Excel. A CSV ("comma separated values") is a text file format in which data is separated by commas/semicolons. This format can be handled by many programs, so you can transfer data from one program to another.
- open Excel and go to the File/Open/Browse menu, then select All files, choose the triangles.csv file
- in the following dialog box navigate to the file you want to open
- we then need to specify that the data are separated by which kind of symbol (Delimiter)
- choose the Semicolon option
- nothing else needs to be set, click Load
Each row in the table contains the data of one triangle. For the perimeter we need the sum of the sides, and for the area we can use Heron's formula:
, where a, b, c are the sides of the triangle and s is half of the perimeter.
- enter "perimeter", "s", "area" in order in cells E1, F1, G1
- calculate the perimeter in cell E2 using the SUM function:
=SUM(B2:D2)
- count half of the perimeter in cell F2:
=E2/2
- and in cell G2 enter Heron's formula
=SQRT(F2*(F2-B2)*(F2-C2)*(F2-D2))
The angles are named according to the attached illustration. Use the cosine theorem to determine the gamma angle opposite of side c. According to the theorem:
c² = a² + b² - 2⋅a⋅b⋅cos(γ),
ebből:
The other two angles are determined by the sine theorem:
,
így
α = asin(a⋅sin(γ)/c)),
β = asin(b⋅sin(γ)/c))
- in cells H1, I1, J1 enter "alpha", "beta", "gamma"
- first calculate the gamma in cell J2 by substituting it into the formula above:
=ACOS((B2^2+C2^2-D2^2)/(2*B2*C2))
- use gamma to calculate the alpha value in cell H2:
=ASIN(B2*SIN(J2)/D2)
- similarly in the I2 cell:
=ASIN(C2*SIN(J2)/D2)
- copy the formulae downwards by double-clicking
Next to the data, calculate the materials needed in a small table. Fill in column L according to the diagram!
Of the data to be calculated, we can only estimate the length of the adhesive tape, since (1) only 1 strip of adhesive tape is needed at the junction of two triangles, (2) no adhesive tape is needed at the edges of the structure. If we take half of the total circumference of the triangles, we overestimate the amount of adhesive required and make an error on the side of safety.
- calculate the total area in cell M2:
=SUM(H:H)
- in cell M3, you can specify any column - containing numbers - for the number of items in the COUNT() function:
=COUNT(H:H)
- the average area is calculated in cell M4:
=AVERAGE(H:H)
- you can take half the total circumference for the estimated length of the tape, or you can sum s:
=SUM(E:E)/2
HINT: The SUM(), AVERAGE(), COUNT(), MIN(), MAX() functions ignore the cells containing the text, so we don't have to deal with the headers, we can pass them the whole column.
Now we only need to mark angles smaller than 20°. Since the angles are given in radians, we first need to convert 20° to radians. Then we use the resulting number to set the conditional formatting: only those cells that contain angles less than 20° are coloured.
- perform the conversion in cell M9:
=RADIANS(20)
- select columns H:J
- select the Home / Conditional Formatting / Highlight Cells Rules / Less than menu item
- in the window that appears, enter the above value
You can compare your solution with the solution key.
3. Solving a quadratic equation (Practice)
Excercise: make a small table in which if you enter the coefficients of the quadratic equation you get back the solutions! Also calculate the discriminant and use conditional formatting to indicate if its value is negative!
Solver of the quadratic equation ax² + bx + c = 0:
,
and the discriminant is the part below the root. If the discriminant is negative, then there is no solution to the equation on the set of real numbers.
- enter any values for a, b, c in cells B1,B2,B3
- calculate the discriminant in cell B5:
=B2^2-4*B1*B3
- calculate the value of x1 in cell B6:
=-B2+SQRT(B5)/(2*B1)
- calculate the value of x2 in cell B7:
=-B2-SQRT(B5)/(2*B1)
If the error message #NUM! appears in cells x1 and x2, the value of D is probably negative. Excel can't draw a square root from a negative number, so it gives an error, but that's OK for now.
Let's set conditional formatting to color the cell containing the discriminant red if its value is negative.
- select the Home / Conditional Formatting / Highlight Cells Rules / Less than menu item
- in the window that appears, type 0
There are several ways to avoid such mistakes, and we will discuss them in more detail in the future.