Basic Excel Formulas and Functions Tutorial
Excel is a powerful tool for organizing, analyzing, and visualizing data. Here’s a quick guide to some
essential formulas and functions to get you started:
1. Arithmetic Formulas
These are the building blocks for calculations in Excel:
Addition: =A1 + B1
Subtraction: =A1 - B1
Multiplication: =A1 * B1
Division: =A1 / B1
Sum: =SUM(A1:A10) (Adds all values in a range)
Average: =AVERAGE(A1:A10) (Calculates the mean)
2. Logical Functions
Logical functions help you make decisions in your data:
IF: =IF(A1>10, "Yes", "No") (Returns "Yes" if A1 > 10, otherwise "No")
AND: =AND(A1>10, B1<5) (Returns TRUE if both conditions are met)
OR: =OR(A1>10, B1<5) (Returns TRUE if either condition is met)
3. Text Functions
Manipulate and clean text data:
CONCATENATE: =CONCATENATE(A1, " ", B1) (Joins text from A1 and B1 with a space)
LEFT: =LEFT(A1, 5) (Extracts the first 5 characters from A1)
RIGHT: =RIGHT(A1, 3) (Extracts the last 3 characters from A1)
LEN: =LEN(A1) (Counts the number of characters in A1)
4. Lookup Functions
Retrieve data from a table or range:
VLOOKUP: =VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])
HLOOKUP: =HLOOKUP(lookup_value, table_array, row_index_num, [range_lookup])
INDEX: =INDEX(array, row_num, [column_num])
5. Date and Time Functions
Work with dates and times effectively:
TODAY: =TODAY() (Returns the current date)
NOW: =NOW() (Returns the current date and time)
DATEDIF: =DATEDIF(start_date, end_date, "unit") (Calculates the difference between two
dates)
6. Error Handling
Handle errors gracefully:
IFERROR: =IFERROR(A1/B1, "Error") (Returns "Error" if there’s a division by zero)
Tips for Using Formulas
Always start formulas with an = sign.
Use parentheses () to control the order of operations.
Use cell references (e.g., A1) instead of hardcoding values for flexibility.
COUNT Function
The COUNT function in Excel counts the number of cells that contain numbers in a given range.
Syntax:
COUNT(value1, [value2], …)
value1, value2, … are the cells or ranges you want to count.
Only numbers are counted; text or blank cells are ignored.
Example
Suppose we have a dataset of students’ marks:
Student Marks
Alice 85
Bob 90
Charlie 78
David
Emma 92
Frank 88
Grace 80
Henry
Ivy 75
Jack 82
We want to count how many students have marks entered (non-blank numbers).
Formula:
=COUNT(B2:B11)
Explanation:
B2:B11 is the range of marks.
COUNT will ignore blank cells and count only numeric values.
Result:
8
Student Marks COUNT (Numbers) COUNTIF (>80) COUNTA (Non-empty)
Alice 85 =COUNT(B2:B11) =COUNTIF(B2:B11,">80") =COUNTA(B2:B11)
Bob 90
Charlie 78
David
Emma 92
Frank 88
Grace 80
Henry
Ivy 75
Jack 82
How it works:
1. Paste the table into Excel.
2. Enter the formulas in row 2, in the corresponding columns.
3. Excel will automatically calculate:
o COUNT → 8
o COUNTIF (>80) → 5
o COUNTA → 8
Steps for Conditional Formatting in Excel
1. Select the Marks column:
o Click and drag to select B2:B11.
2. Go to Conditional Formatting:
o In the Excel ribbon → Home → Conditional Formatting → New Rule…
3. Set the Rule:
o Choose “Use a formula to determine which cells to format”
o Enter this formula:
o =B2>80
o Click Format… → choose a fill color (e.g., light green) → OK
4. Apply the Rule:
o Click OK again.
o All cells in B2:B11 with marks greater than 80 will now be highlighted.
✅ Result
Cells with Alice 85, Bob 90, Emma 92, Frank 88, Jack 82 will be highlighted.
It’s an easy visual way to see which students scored above 80.
SUMIF Function
The SUMIF function adds the values in a range that meet a specific condition.
Syntax:
SUMIF(range, criteria, [sum_range])
range → the cells to evaluate the condition
criteria → the condition (e.g., ">80")
sum_range → the cells to sum (optional, if different from range)
Example Table (10 Rows)
Student Marks Group
Alice 85 A
Bob 90 B
Charlie 78 A
David 45 B
Emma 92 A
Frank 88 B
Grace 80 A
Henry 55 B
Student Marks Group
Ivy 75 A
Jack 82 B
1️⃣ Example 1: Sum marks greater than 80
=SUMIF(B2:B11, ">80")
Explanation:
Checks B2:B11 for numbers >80 and sums them.
Result:
85 + 90 + 92 + 88 + 82 = 437
2️⃣ Example 2: Sum marks for Group A
=SUMIF(C2:C11, "A", B2:B11)
Explanation:
Checks C2:C11 for "A"
Sums corresponding marks in B2:B11
Result:
85 + 78 + 92 + 80 + 75 = 410
3️⃣ Example 3: Sum marks for Group B above 80
=SUMIF(B2:B11, ">80", B2:B11*(C2:C11="B"))
In Excel, a simpler way is to use SUMIFS if multiple conditions are needed.
For multiple conditions, it’s better to use SUMIFS:
=SUMIFS(B2:B11, C2:C11, "B", B2:B11, ">80")
Result:
90 + 88 + 82 = 260
IF Function
The IF function checks a condition and returns one value if the condition is TRUE and another if it is
FALSE.
Syntax:
IF(condition, value_if_true, value_if_false)
condition → what you want to test (e.g., B2>=50)
value_if_true → what to show if the condition is TRUE
value_if_false → what to show if the condition is FALSE
Example Table (10 Rows)
Student Marks
Alice 85
Bob 90
Charlie 78
David 45
Emma 92
Frank 88
Grace 80
Henry 55
Ivy 75
Jack 40
1️⃣ Example 1: Pass/Fail
Pass if marks ≥50, otherwise Fail:
=IF(B2>=50, "Pass", "Fail")
Results:
Student Marks Result
Alice 85 Pass
Bob 90 Pass
Charlie 78 Pass
David 45 Fail
Emma 92 Pass
Frank 88 Pass
Grace 80 Pass
Henry 55 Pass
Student Marks Result
Ivy 75 Pass
Jack 40 Fail
2️⃣ Example 2: Grade Assignment
Assign grades based on marks:
≥90 → A
80–89 → B
70–79 → C
<70 → D
Formula using nested IF:
=IF(B2>=90,"A",IF(B2>=80,"B",IF(B2>=70,"C","D")))
Results:
Student Marks Grade
Alice 85 B
Bob 90 A
Charlie 78 C
David 45 D
Emma 92 A
Frank 88 B
Grace 80 B
Henry 55 D
Ivy 75 C
Jack 40 D
Nested IF Function
A nested IF is an IF function inside another IF. It allows multiple conditions to be checked in a single
formula.
Syntax:
IF(condition1, value_if_true1, IF(condition2, value_if_true2, IF(condition3, value_if_true3,
value_if_false)))
Example Table (10 Rows)
Student Marks
Alice 85
Bob 90
Charlie 78
David 45
Emma 92
Frank 88
Grace 80
Henry 55
Ivy 75
Jack 40
Nested IF Example: Assign Grades
≥90 → A
80–89 → B
70–79 → C
50–69 → D
<50 → F
Formula:
=IF(B2>=90,"A",IF(B2>=80,"B",IF(B2>=70,"C",IF(B2>=50,"D","F"))))
Explanation:
1. Check if B2 >= 90 → If TRUE, return "A"
2. If FALSE, check if B2 >= 80 → If TRUE, return "B"
3. If FALSE, check if B2 >= 70 → If TRUE, return "C"
4. If FALSE, check if B2 >= 50 → If TRUE, return "D"
5. Otherwise → return "F"
Result Table
Student Marks Grade
Alice 85 B
Student Marks Grade
Bob 90 A
Charlie 78 C
David 45 F
Emma 92 A
Frank 88 B
Grace 80 B
Henry 55 D
Ivy 75 C
Jack 40 F
LOOKUP Function
The LOOKUP function is used to search for a value in a range and return a corresponding value from
another range.
Syntax (Vector Form):
LOOKUP(lookup_value, lookup_vector, result_vector)
lookup_value → the value you want to search for
lookup_vector → the range where Excel searches the value
result_vector → the range from which Excel returns a value
Note: LOOKUP requires the lookup_vector to be sorted in ascending order.
Example Table (10 Rows)
Student Marks
Alice 85
Bob 90
Charlie 78
David 45
Emma 92
Frank 88
Grace 80
Henry 55
Ivy 75
Jack 40
Example 1: Assign Grades using LOOKUP
Suppose we have a grade table:
Minimum Marks Grade
0 F
50 D
70 C
80 B
90 A
Formula to get grade for Alice (B2):
=LOOKUP(B2, {0,50,70,80,90}, {"F","D","C","B","A"})
Explanation:
Looks up B2 (85) in {0,50,70,80,90}
Finds the largest number ≤ 85 → 80
Returns the corresponding grade from {"F","D","C","B","A"} → B
Result Table
Student Marks Grade (LOOKUP)
Alice 85 B
Bob 90 A
Charlie 78 C
David 45 F
Emma 92 A
Frank 88 B
Grace 80 B
Henry 55 D
Ivy 75 C
Jack 40 F
✅ Why use LOOKUP?
Easier than nested IFs for multiple conditions
Automatically finds the closest match without writing many IF statements
VLOOKUP Function
The VLOOKUP function searches for a value in the first column of a table and returns a value from
another column in the same row.
Syntax:
VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])
lookup_value → the value you want to search for
table_array → the range containing your data
col_index_num → the column number to return the value from (starting from 1)
range_lookup → TRUE (approximate match) or FALSE (exact match)
Example Table (10 Students)
Marks Table:
Student Marks
Alice 85
Bob 90
Charlie 78
David 45
Emma 92
Frank 88
Grace 80
Henry 55
Ivy 75
Jack 40
Grade Table:
Min Marks Grade
0 F
50 D
70 C
80 B
90 A
Example 1: Assign Grades using VLOOKUP
Formula (for Alice, Marks in B2, Grade Table in E2:F6):
=VLOOKUP(B2, $E$2:$F$6, 2, TRUE)
Explanation:
1. B2 → Alice’s marks (85)
2. $E$2:$F$6 → the grade table
3. 2 → return the value from the 2nd column (Grade)
4. TRUE → approximate match (find the largest value less than or equal to 85)
Result for Alice: B
Result Table with Grades
Student Marks Grade (VLOOKUP)
Alice 85 B
Bob 90 A
Charlie 78 C
David 45 F
Emma 92 A
Frank 88 B
Grace 80 B
Henry 55 D
Ivy 75 C
Jack 40 F
✅ Why use VLOOKUP?
Great for matching a value in a table and retrieving associated data
Handles approximate or exact matches
Less messy than multiple nested IFs