Published by Patrick Mutisya · 14 days ago
A function is a predefined formula that performs a calculation using one or more arguments (inputs) and returns a result. In spreadsheets, functions begin with an equals sign (=) followed by the function name and arguments in parentheses.
When a function is used as an argument inside another function, the functions are said to be nested. Nesting allows you to combine several calculations in a single formula.
| Function | Purpose | Syntax (example) |
|---|---|---|
| IF | Logical test – returns one value if true, another if false | =IF(A1>10, "High", "Low") |
| SUM | Adds a range of numbers | =SUM(B1:B5) |
| A \cdot ERAGE | Calculates the mean of a range | =A \cdot ERAGE(C1:C10) |
| VLOOKUP | Searches for a value in the first column of a table and returns a value in the same row from a specified column | =VLOOKUP(D2, \$A\$1:\$C\$20, 3, FALSE) |
| LEN | Returns the length of a text string | =LEN(E2) |
| LEFT / RIGHT | Extracts a specified number of characters from the start or end of a text string | =LEFT(F2,3) |
Goal: Assign a grade based on a numeric score. The grading scheme is:
Using nested IF functions, the formula for cell B2 (where A2 contains the score) is:
=IF(A2>=80, "A", IF(A2>=70, "B", IF(A2>=60, "C", "F")))
Goal: Sum sales figures in column D only for rows where the region (column B) is “North”.
We can nest IF inside SUM using an array‑style approach (compatible with most spreadsheet programs):
=SUM(IF(B2:B20="North", D2:D20, 0))
Remember to confirm the formula as an array formula (e.g., press Ctrl+Shift+Enter in Excel).
Goal: Return “OK” if a product code in E2 is exactly 8 characters long; otherwise return “Check”.
Formula:
=IF(LEN(E2)=8, "OK", "Check")
( must have a closing ).=IF(AND(C3>=50, D3>=0.75), "Pass", "Fail")=SUM(IF(A2:A15>20, A2:A15*B2:B15, 0)) (enter as an array formula)=IF(ISNUMBER(MATCH(DAY(F2), {2,3,5,7,11,13,17,19,23,29,31}, 0)), TEXT(F2, "mmmm"), "")