Excel supports several data types, including :
#DIV/0!
, #VALUE!
).In Microsoft Excel, a cell is a single rectangular box within the spreadsheet grid, formed by the intersection of a row and a column. It’s the basic unit where you can enter, store, and manipulate data—whether that’s text, numbers, or formulas. Each cell is identified by a unique address, like "A1" (column A, row 1), which lets you reference it for calculations or formatting.
For example, you might type "42" into cell B3, then use a formula like "=B3+10" in another cell to get 52. Cells can also hold more complex stuff—like dates, percentages, or even conditional logic—and you can format them to change their appearance (e.g., bold text, currency symbols).
A workbook in Excel is a file that contains one or more worksheets (spreadsheets). It serves as the main container where all your data, formulas, charts, and tables are stored.
You can freeze rows or columns in Excel to keep them visible while scrolling. Here’s how :
The key difference between a workbook and a worksheet in Excel is:
You can remove duplicates in Excel using the built-in Remove Duplicates feature. Here’s how :
If you want to highlight duplicates before deleting them:
In Excel, you can apply filters in several ways to display specific data while hiding the rest. Here are the different methods:
You can filter based on specific conditions like:
In Microsoft Excel, the Find and Replace feature helps you quickly locate specific data in a spreadsheet and, if needed, replace it with something else. Here’s how to use it:
Say your sheet has "2024" scattered around, and you want to update it to "2025" :
It’s a fast way to clean up or update data without manually hunting through rows and columns.
In Excel, COUNT, COUNTA, COUNTIF, and COUNTIFS are functions used to count cells based on different conditions. Here’s how they differ:
=COUNT(range)
=COUNT(A1:A10)
=COUNTA(range)
=COUNTA(A1:A10)
Counts cells that meet a specific condition (can be text, numbers, or logical expressions).
Syntax:
=COUNTIF(range, criteria)
Example:
=COUNTIF(A1:A10, ">10")
Example for text:
=COUNTIF(A1:A10, "apple")
=COUNTIFS(range1, criteria1, range2, criteria2, ...)
=COUNTIFS(A1:A10, ">10", B1:B10, "Approved")
Function | Counts What? | Conditions? |
---|---|---|
COUNT | Numbers only | No conditions |
COUNTA | All non-empty cells (numbers & text) | No conditions |
COUNTIF | Based on a single condition | Yes |
COUNTIFS | Based on multiple conditions | Yes |
Creating a drop-down list in Microsoft Excel is a handy way to limit what users can enter in a cell, making data entry consistent and efficient. Here’s how to do it using the Data Validation feature:
Want a cell (say, B2) to only allow "Red," "Blue," or "Green"?
In Excel, cell references determine how a formula behaves when copied to other cells. There are three types of cell references: Absolute, Relative, and Mixed.
=A1+B1
* When you want the formula to adjust dynamically when copied.
=$A$1+B1
* When you always want to refer to a fixed cell (e.g., tax rates, constants).
=$A1+B$1
* When copying across rows or columns but needing part of the reference to stay the same.
Reference Type | Example | Changes When Copied? |
---|---|---|
Relative | A1 |
Yes (both row & column adjust) |
Absolute | $A$1 |
No (stays fixed) |
Mixed (Column Fixed) | $A1 |
Row changes, but column is fixed |
Mixed (Row Fixed) | A$1 |
Column changes, but row is fixed |
Both VLOOKUP and HLOOKUP are used to search for a value in a dataset and return a corresponding value from another column or row.
Searches for a value in the first column of a table and returns a value from a specified column in the same row.
Works when data is arranged in vertical columns.
Syntax:
=VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])
Arguments:
lookup_value
: The value to search for.table_array
: The range containing data.col_index_num
: The column number from which to return the result.[range_lookup]
: TRUE
(approximate match) or FALSE
(exact match). Default is TRUE
.Example:
Suppose we have a table in A2:C5:
ID | Name | Score |
---|---|---|
101 | John | 85 |
102 | Alice | 92 |
103 | Bob | 78 |
Formula:
=VLOOKUP(102, A2:C5, 2, FALSE)
Result: "Alice"
(Finds 102 in column A and returns Name from column 2).
Searches for a value in the first row of a table and returns a value from a specified row in the same column.
Works when data is arranged in horizontal rows.
Syntax:
=HLOOKUP(lookup_value, table_array, row_index_num, [range_lookup])
Arguments:
lookup_value
: The value to search for.table_array
: The range containing data.row_index_num
: The row number from which to return the result.[range_lookup]
: TRUE
(approximate match) or FALSE
(exact match).Example:
Suppose we have data in A1:E2:
ID | 101 | 102 | 103 | 104 |
---|---|---|---|---|
Score | 85 | 92 | 78 | 88 |
Formula:
=HLOOKUP(103, A1:E2, 2, FALSE)
Result: 78
(Finds 103 in row 1 and returns Score from row 2).
Feature | VLOOKUP | HLOOKUP |
---|---|---|
Searches in | First column | First row |
Works on | Vertical data | Horizontal data |
Returns from | A specified column | A specified row |
Example Use | Find price of a product | Find sales by month |
Both VLOOKUP and INDEX-MATCH are used for searching and retrieving data, but INDEX-MATCH is more powerful and flexible. Here’s how they differ:
Searches for a value in the first column and returns data from a specified column in the same row.
Syntax:
=VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])
Example:
ID | Name | Score |
---|---|---|
101 | John | 85 |
102 | Alice | 92 |
103 | Bob | 78 |
=VLOOKUP(102, A2:C4, 2, FALSE)
Result: "Alice"
(Finds ID 102 in column A and returns Name from column 2).
INDEX and MATCH are used together to perform lookups, offering more flexibility.
INDEX retrieves data from a specific row and column.
MATCH finds the position of a lookup value.
Syntax:
=INDEX(return_range, MATCH(lookup_value, lookup_range, [match_type]))
Example:
=INDEX(B2:B4, MATCH(102, A2:A4, 0))
Result: "Alice"
(Finds ID 102 in column A and returns the corresponding Name from column B).
Feature | VLOOKUP | INDEX-MATCH |
---|---|---|
Lookup Direction | Only left to right | Can look left or right |
Column Changes | Breaks if columns are inserted/deleted | Works dynamically |
Performance | Slower for large datasets | Faster for large datasets |
Flexibility | Limited to vertical lookups | Can be used for both vertical & horizontal lookups |
Ease of Use | Simple and easy | Slightly complex |
Conditional Formatting allows you to highlight cells based on specific conditions, making it easier to visualize data trends.
A1:A10
or A1:D10
).50
, choose a formatting style, and click OK.You can use a formula to apply formatting dynamically.
=A1>AVERAGE($A$1:$A$10)
These functions are used to create logical tests in Excel, helping to make decisions based on conditions.
The IF function checks a condition and returns one value if TRUE and another if FALSE.
=IF(logical_test, value_if_true, value_if_false)
If a student’s score is ≥50, return "Pass"
, otherwise "Fail"
:
=IF(A1>=50, "Pass", "Fail")
The AND function checks if all conditions are TRUE. If even one condition is FALSE, the result is FALSE.
=AND(condition1, condition2, ...)
Check if a score (A1) is ≥50 and attendance (B1) is ≥75%:
=AND(A1>=50, B1>=75)
=IF(AND(A1>=50, B1>=75), "Pass", "Fail")
The OR function checks if at least one condition is TRUE.
=OR(condition1, condition2, ...)
Check if a student passed either the exam (A1≥50) or extra credit (B1≥60):
=OR(A1>=50, B1>=60)
=IF(OR(A1>=50, B1>=60), "Pass", "Fail")
A Nested IF is when you use multiple IF functions inside each other for more than two conditions.
Grade students based on their scores:
=IF(A1>=90, "A", IF(A1>=80, "B", IF(A1>=70, "C", IF(A1>=60, "D", "F"))))
Function | Purpose | Example |
---|---|---|
IF | Returns values based on a condition | =IF(A1>50, "Pass", "Fail") |
AND | Checks if all conditions are TRUE | =AND(A1>50, B1>75) |
OR | Checks if at least one condition is TRUE | =OR(A1>50, B1>75) |
Nested IF | Handles multiple conditions | =IF(A1>90, "A", IF(A1>80, "B", "C")) |
A Pivot Table is a powerful tool in Excel that allows you to summarize, analyze, and visualize large datasets quickly. It helps in grouping, filtering, and calculating data dynamically without modifying the original dataset.
Once the Pivot Table is created, you’ll see a PivotTable Fields pane on the right. Drag and drop fields into different areas:
Pivot Table Area | Function |
---|---|
Rows | Adds data as row labels (categories) |
Columns | Adds data as column labels |
Values | Performs calculations (Sum, Count, Average, etc.) |
Filters | Adds a top-level filter for the entire table |
Date | Product | Sales Rep | Amount |
---|---|---|---|
01-Jan | Laptop | John | 1500 |
02-Jan | Phone | Alice | 800 |
03-Jan | Laptop | Bob | 1200 |
04-Jan | Phone | John | 900 |
Product | Total Sales |
---|---|
Laptop | 2700 |
Phone | 1700 |
* Saves time – No need for manual calculations.
* Handles large data – Works efficiently with thousands of rows.
* Dynamic Analysis – Quickly change views using drag-and-drop.
* Easy to update – Refresh the Pivot Table when data changes.
These functions help manipulate and format text in Excel.
The TEXT
function converts a number into a formatted text string.
=TEXT(value, format_text)
value
→ The number or cell to format.format_text
→ The format to apply (e.g., "MM/DD/YYYY"
, "$#,##0.00"
).Format a date as "Month Day, Year"
:
=TEXT(A1, "MMMM DD, YYYY")
01/01/2024
, result → "January 01, 2024"
Format a number as currency:
=TEXT(A1, "$#,##0.00")
1234.5
, result → "$1,234.50"
The LEFT
function returns a specific number of characters from the beginning (left side) of a text string.
=LEFT(text, num_chars)
text
→ The text or cell to extract from.num_chars
→ Number of characters to extract.Extract the first 3 characters of "Excel"
:
=LEFT("Excel", 3)
Result: "Exc"
Extract first 2 characters from A1:
=LEFT(A1, 2)
"Product123"
, result → "Pr"
The RIGHT
function returns a specific number of characters from the end (right side) of a text string.
=RIGHT(text, num_chars)
Extract the last 3 digits of a phone number ("123456789"
):
=RIGHT("123456789", 3)
Result: "789"
Extract the last 4 characters from A1:
=RIGHT(A1, 4)
"Invoice2024"
, result → "2024"
The MID
function extracts a substring from the middle of a text, based on a start position and length.
=MID(text, start_num, num_chars)
text
→ The text or cell to extract from.start_num
→ Position of the first character to extract.num_chars
→ Number of characters to extract.Extract "cro" from "Microsoft"
:
=MID("Microsoft", 3, 3)
Result: "cro"
Extract 5 characters starting from the 4th position in A1:
=MID(A1, 4, 5)
"Product123"
, result → "duct1"
Function | Purpose | Example | Result |
---|---|---|---|
TEXT |
Format numbers as text | =TEXT(1234.5, "$#,##0.00") |
"$1,234.50" |
LEFT |
Extract from the left | =LEFT("Excel", 3) |
"Exc" |
RIGHT |
Extract from the right | =RIGHT("Excel", 2) |
"el" |
MID |
Extract from the middle | =MID("Microsoft", 3, 3) |
"cro" |
The Ribbon in Microsoft Excel is the wide, customizable toolbar at the top of the window that organizes commands and features into a user-friendly interface. Introduced in Excel 2007 (replacing old-style menus), it’s designed to make tools easily accessible without digging through nested menus. It’s divided into tabs, groups, and commands—here’s the breakdown:
Want to bold text in cell A1?
Ctrl + Z
), while Redo re-applies an undone action (Ctrl + Y
). These shortcuts are useful for correcting mistakes or reapplying changes.
In Microsoft Excel (and spreadsheets generally), the difference between a column and a row boils down to their orientation and how they’re organized in the grid:
Aspect | Column | Row |
---|---|---|
Direction | Vertical (up/down) | Horizontal (left/right) |
Label | Letters (A, B, C…) | Numbers (1, 2, 3…) |
Example Cells | A1, A2, A3 | A1, B1, C1 |
Typical Use | Data categories | Data records |
Imagine a table of student grades :
In Microsoft Excel, you can create a hyperlink to link a cell to a webpage, file, email address, or even another spot in your workbook. Here’s how to do it, with a few methods depending on your goal:
To link cell B2 to xAI’s site :
Protecting a worksheet or specific cells in Excel ensures that users can only make changes where you want them to, preventing accidental or unauthorized modifications. Here’s how to do it:
By default, every cell in an Excel worksheet is locked—but this lock only takes effect once the worksheet is protected. To protect only certain cells:
Data Validation in Excel is a feature that helps control and restrict the type of data entered into a cell. It ensures accuracy and consistency by allowing only predefined values or formats.
* Prevent Invalid Data Entry – Restrict users from entering incorrect values.
* Ensure Data Consistency – Standardize inputs like dates, numbers, or text formats.
* Improve Data Entry Efficiency – Guide users with dropdown lists or error messages.
* Enhance Accuracy – Minimize errors in calculations and reports.
Click OK to Apply.
A1:A10
).Apple, Banana, Orange
1
, Maximum: 100
.01/01/2024
and the end date as 12/31/2024
.=ISNUMBER(SEARCH("@", A1))
In Microsoft Excel, the INDEX-MATCH combination is a powerful alternative to VLOOKUP for looking up data. It’s more flexible because it doesn’t rely on a fixed column position and can search in any direction (left, right, or even across sheets). Here’s how to use it, step-by-step:
Combined : =INDEX(return_range, MATCH(lookup_value, lookup_range, 0))
Imagine this table in A1:B5:
Product | Price |
---|---|
Apple | 0.50 |
Banana | 0.30 |
Orange | 0.75 |
Grape | 1.00 |
You want to find the price of "Orange" and put it in cell D1.
Say you’re tracking sales across sheets, and columns shift. VLOOKUP fails if "Sales" moves left of "Product ID." INDEX-MATCH doesn’t care—just point MATCH at the ID column and INDEX at the Sales column, wherever they are.
These functions help you sum, count, or average values based on multiple conditions.
The SUMIFS
function adds up values that meet multiple criteria.
=SUMIFS(sum_range, criteria_range1, criteria1, [criteria_range2, criteria2], ...)
sum_range
→ The range of values to sum.criteria_range1, criteria1
→ The first condition.criteria_range2, criteria2
→ (Optional) Additional conditions.Scenario : Sum sales where the region is "North" and product is "Laptop".
Region | Product | Sales |
---|---|---|
North | Laptop | 500 |
South | Laptop | 300 |
North | Phone | 400 |
North | Laptop | 600 |
=SUMIFS(C2:C5, A2:A5, "North", B2:B5, "Laptop")
* Result : 500 + 600 = 1100
The COUNTIFS
function counts the number of values that meet multiple criteria.
=COUNTIFS(criteria_range1, criteria1, [criteria_range2, criteria2], ...)
criteria_range1, criteria1
→ The first condition.criteria_range2, criteria2
→ (Optional) Additional conditions.Scenario : Count how many times "Laptop" was sold in "North" region.
=COUNTIFS(A2:A5, "North", B2:B5, "Laptop")
* Result: 2
The AVERAGEIFS
function calculates the average of values that meet multiple conditions.
=AVERAGEIFS(average_range, criteria_range1, criteria1, [criteria_range2, criteria2], ...)
average_range
→ The range of values to average.criteria_range1, criteria1
→ The first condition.criteria_range2, criteria2
→ (Optional) Additional conditions.Scenario: Find the average sales where the region is "North" and product is "Laptop".
=AVERAGEIFS(C2:C5, A2:A5, "North", B2:B5, "Laptop")
* Result : (500 + 600) / 2 = 550
Function | Purpose | Example | Result |
---|---|---|---|
SUMIFS |
Sum values with multiple conditions | =SUMIFS(C2:C5, A2:A5, "North", B2:B5, "Laptop") |
1100 |
COUNTIFS |
Count occurrences with multiple conditions | =COUNTIFS(A2:A5, "North", B2:B5, "Laptop") |
2 |
AVERAGEIFS |
Find the average with multiple conditions | =AVERAGEIFS(C2:C5, A2:A5, "North", B2:B5, "Laptop") |
550 |
* Efficient for large datasets
* Handles multiple conditions
* Reduces the need for manual filtering
XLOOKUP
is an improved lookup function that can search in any direction and return a value or array. For example, =XLOOKUP("Apple", A1:A10, B1:B10)
searches for "Apple" in column A and returns the corresponding value from column B.
Creating dynamic named ranges in Excel allows your ranges to automatically adjust as you add or remove data. Here's a breakdown of how to do it, focusing on the most common and effective methods:
Key Concepts :
Methods :
Using OFFSET and COUNTA:
OFFSET
function defines the starting point and size of the range, while COUNTA
determines the size based on the number of filled cells.=OFFSET(Sheet1!$A$1, 0, 0, COUNTA(Sheet1!$A:$A), 1)
Sheet1!$A$1
: The starting cell of your range.0, 0
: No row or column offset.COUNTA(Sheet1!$A:$A)
: Counts the non-empty cells in column A, determining the height of the range., 1
: The width of the range (1 column).Using INDEX and COUNTA :
=Sheet1!$A$1:INDEX(Sheet1!$A:$A,COUNTA(Sheet1!$A:$A))
Sheet1!$A$1:
Is the starting cell.INDEX(Sheet1!$A:$A,COUNTA(Sheet1!$A:$A))
: this portion of the formula finds the last none empty cell in column A, and sets that as the ending cell of the range.
Important Considerations:
COUNTA
to work accurately, ensure there are no blank cells within your data range.OFFSET
function is volatile, meaning it recalculates every time Excel recalculates. This can slow down large workbooks. The INDEX
function method is not volatile.By using these methods, you can create dynamic named ranges that will save you time and ensure your formulas always reference the correct data.
Both the OFFSET and INDIRECT functions in Excel are powerful tools that provide flexibility in referencing cells and ranges, but they serve different purposes:
OFFSET Function :
INDIRECT Function:
In Summary:
Excel provides a built-in "Consolidate" feature, along with other methods, to gather and summarize data from multiple worksheets. Here's a breakdown of the primary techniques:
1. Using the Consolidate Feature :
2. Using Formulas :
=Sheet1!A1+Sheet2!A1+Sheet3!A1
3. Using PivotTables :
Key Considerations :
Power Pivot is a powerful Excel add-in that allows you to perform robust data analysis and create sophisticated data models. Here's a breakdown of how to use it:
1. Enabling Power Pivot :
2. Understanding Key Concepts :
3. Basic Workflow :
Key Benefits of Power Pivot :
Where to Find More Information :
Power Pivot is a valuable tool for anyone who needs to analyze large and complex datasets in Excel.
Understanding the distinctions between Excel Tables and Named Ranges is crucial for efficient data management in Excel. Here's a breakdown of their key differences:
Named Ranges :
Excel Tables :
Key Differences Summarized :
In essence, Named Ranges are best for simplifying references, while Excel Tables are ideal for managing and analyzing structured data.
Excel's Goal Seek and Solver are both "what-if" analysis tools, but they handle different levels of complexity. Here's a breakdown of how to use them:
Goal Seek :
Solver :
Key Differences :
Removing blank rows or columns is a common data cleaning task in Excel. Here's a breakdown of effective methods:
Removing Blank Rows :
Ctrl + G
(or F5
) to open the "Go To" dialog box.=COUNTA(A1:Z1)
(adjust the range to cover all columns in your data).
Removing Blank Columns :
Important Notes :
Handling a dataset with thousands of duplicate records in Excel requires a systematic approach to ensure data integrity while removing unnecessary duplicates. Here’s how you can manage it:
If you want to remove exact duplicates:
* Best for: Removing complete duplicate rows.
If you want to review duplicates before deleting them:
* Best for: Visually identifying duplicates before taking action.
If you need custom duplicate detection, use the COUNTIF
function.
=COUNTIF(A:A, A2) > 1
TRUE
for duplicates.TRUE
and delete duplicate rows.* Best for: Detecting partial duplicates or applying manual checks.
If you’re dealing with huge datasets (thousands of records), Power Query is efficient.
* Best for: Large datasets with complex duplicate conditions.
If you want to extract a unique list without deleting data:
* Best for : Keeping the original dataset untouched while working with unique values.
Method | Best For |
---|---|
Remove Duplicates | Quick deletion of exact duplicate rows |
Conditional Formatting | Identifying duplicates visually |
COUNTIF Formula | Custom duplicate detection |
Power Query | Handling large datasets efficiently |
Advanced Filter | Extracting unique records without deleting |
If you have two lists and need to compare them, Excel offers multiple methods depending on the complexity of your data and the type of comparison required.
If you want to visually compare two lists and highlight matches or differences:
A2:A10
).=COUNTIF($B$2:$B$10, A2) = 0
A2:A10
that are not in List B.=COUNTIF($A$2:$A$10, B2) = 0
B2:B10
that are not in List A.* Best for: Quick visual comparison of lists.
If you need a clear TRUE/FALSE result in a helper column:
C
, use this formula next to values in List A:
=IF(COUNTIF(B:B, A2) > 0, "Match", "No Match")
A2
exists in List B.* Best for: Easily filtering and sorting results.
If you want to return a message when values in List A don’t exist in List B:
C
, use this formula:
=IF(ISNA(VLOOKUP(A2, B:B, 1, FALSE)), "Not in List B", "Found in List B")
* Best for: Checking presence in another list while avoiding errors.
If you want to check if values in List A exist in List B without using extra columns:
=IF(ISNUMBER(MATCH(A2, B:B, 0)), "Exists", "Missing")
* Best for: Exact matches without retrieving additional data.
For large datasets, Power Query is more efficient.
* Best for: Comparing thousands of records efficiently.
Method | Best For |
---|---|
Conditional Formatting | Highlighting differences visually |
COUNTIF Formula | Checking if values exist in another list |
VLOOKUP | Finding missing values with custom messages |
MATCH Function | Quick comparison without extra columns |
Power Query | Large datasets and complex comparisons |
Functions |
Subroutines |
A function is responsible for returning the value of the task it is performing. |
Meanwhile, subroutines don’t return the value of the task it is performing. |
They are called by a variable. |
They can be recalled from anywhere in the program, in multiple types. |
Functions are used as it is in spreadsheets as formulas. |
Subroutines are not used directly in spreadsheets as formulas. |
Functions are used to carry out repetitive tasks, and it, in turn, returns a value. |
Users are required to insert a value in the desired cell before fetching the result of the subroutine. |
Sub Prime()
Dim divisors As Integer, number As Long, i As Long
divisors = 0
number = InputBox(“Enter a number”)
For i = 1 To number
If number Mod i = 0 Then
divisors = divisors + 1
End If
Next i
If divisors = 2 Then
MsgBox number & “ is a prime number”
Else
MsgBox number & “ is not a prime number”
End If
End Sub
Function Area(Length As Double, Optional Width As Variant)
If IsMissing(Width) Then
Area = Length * Length
Else
Area = Length * Width
End If
End Function
Sub CheckFileExists()
Dim strFileName As String
Dim strFileExists As String
strFileName = “File location\file_name.xlsx”
strFileExists = Dir(strFileName)
If strFileExists = “” Then
MsgBox “The selected file doesn't exist”
Else
MsgBox “The selected file exists”
End If
End Sub
Sub FindingLastRow()
Dim lastRow As Long
lastRow = ActiveSheet.Cells.SpecialCells(xlLastCell).Row
MsgBox (lastRow)
End Sub?
To find the last column, use the below lines code in the VBA module :
Sub FindingLastColumn()
Dim lastRow As Long
lastColumn = ActiveSheet.Cells.SpecialCells(xlLastCell).Column
MsgBox (lastColumn)
End Sub