CSC112_Basic_ Formulas in Excel - Copy
CSC112_Basic_ Formulas in Excel - Copy
Introduction to Formulas in
Excel
Introduction to Formulas in Excel
In Excel, a formula is an expression entered in a cell that performs calculations on data.
All formulas begin with an equal sign (=), followed by the operations and functions to be
applied.
Basic Structure of a Formula
Equal Sign (=): All formulas start with =.
Operators: Symbols that specify the type of calculation (e.g., + for addition, - or
subtraction).
Cell References: Indicate specific cells involved in the formula (e.g., A1 or B2:C5).
Functions: Predefined operations like SUM(), AVERAGE(), IF(), and more.
Example: =A1 + B1 adds the values in cells A1 and B1. 2
Basic Arithmetic Formulas
Arithmetic operations are fundamental for data manipulation in Excel. The basic operators
are:
•Addition: + (e.g., =A1 + B1)
•Subtraction: - (e.g., =A1 - B1)
•Multiplication: * (e.g., =A1 * B1)
•Division: / (e.g., =A1 / B1)
•Exponentiation: ^ (e.g., =A1 ^ 2 to square a value)
Example: To calculate the total of cells A1 to A5, you could use =A1 + A2 + A3 + A4 + A5
or the SUM function: =SUM(A1:A5). 3
Using Functions for Data Manipulation
Excel provides a wide array of built-in functions for data manipulation.
These are:
Mathematical Functions
SUM(): Adds all the numbers in a range.
Example: =SUM(A1:A10) sums the values from A1 to A10.
AVERAGE(): Calculates the average of values in a range.
Example: =AVERAGE(B1:B10) finds the average of values from B1 to B10.
MIN() and MAX(): Finds the smallest or largest value in a range.
Example: =MIN(A1:A10) returns the smallest value, while =MAX(A1:A10) returns
the largest.
4
Using Functions for Data Manipulation
Text Functions
CONCATENATE() or CONCAT(): Joins multiple text strings into one.
Example: =CONCATENATE(A1, " ", B1) combines values from A1 and B1 with a space.
LEN(): Counts the number of characters in a text string.
Example: =LEN(A1) returns the character count in cell A1.
LEFT(), RIGHT(), MID(): Extract specific characters from a text string.
Example: =LEFT(A1, 3) extracts the first three characters in A1.
5
Using Functions for Data Manipulation
Logical Functions
IF(): Checks a condition and returns one value if true, another if false.
Syntax: =IF(condition, value_if_true, value_if_false)
Example: =IF(A1 > 50, "Pass", "Fail") checks if A1 is greater than 50 and returns
"Pass" if true, "Fail" if false.
AND() / OR(): Combines multiple conditions.
Example: =AND(A1 > 10, B1 < 20) returns TRUE if both conditions are met.
Example: =OR(A1 > 10, B1 < 20) returns TRUE if at least one condition is met.
6
Using Functions for Data Manipulation
This function is especially useful for looking up data based on a unique identifier or
reference and is often used for tasks like retrieving product details, employee information,
or any data organized in a table.
lookup_value: The value that is to be search for (e.g., an employee ID or product
name).
table_array: The range of cells containing the data to search through.
col_index_num: The column number in the table array from which to return the value.
range_lookup: Optional argument (TRUE or FALSE) to specify an approximate match
(TRUE) or an exact match (FALSE).
8
.
Explanation:
lookup_value: "Monitor" – this is the value we want to search for in the table.
table_array: A2:C5 – this is the range that contains the product list.
col_index_num: 3 – this is the column number in the table array where the price is
located (the third column).
range_lookup: FALSE – we use FALSE for an exact match.
Result: $200
This formula finds "Monitor" in the Product Name column and returns the price
$200 from the Price column.
10
Class work
Find the department of the employee with Employee ID 102.
Employee
Name Department
ID
101 John Smith HR
Maria
102 IT
Garcia
Kevin
103 Finance
Brown
Anna
104 Marketing
White
11
Advanced Formulas for Data Analysis
COUNT function is used to determine how many cells in a range contain a number.
COUNT(): Counts only numeric cells in a range.
Example: =COUNT(A1:A10) counts all numbers in A1 to A10.
The COUNTA function counts all nonblank entries in a range, whether they include
text or numbers.
12
Advanced Formulas for Data Analysis (Cont.)
13
Advanced Formulas for Data Analysis (Cont.)