Home › data analytics Tutorial › Formulas and Functions in Excel for Data Analysis

Formulas and Functions in Excel for Data Analysis

⏱ 17 min read Updated: 28 Sep 2026

Formulas and Functions in Excel

Excel formulas and functions are important tools for analyzing data. They help us perform calculations, summarize information, find specific values, compare data, apply conditions, and extract useful results from large datasets.

When working with data in Excel, we need to calculate totals, averages, percentages, counts, rankings, and other values. Instead of calculating everything manually, we can use formulas and built-in functions to make the process faster and more accurate.

Excel provides a large collection of functions for different types of tasks, including mathematical, statistical, logical, text, date and time, lookup, and financial calculations.

In this article, we will learn the most useful Excel formulas and functions for data analysis, along with their syntax, uses, and practical examples.

What Are Formulas in Excel?

A formula is an expression that performs a calculation using values, cell references, operators, or functions.

Every Excel formula starts with an equal sign (=). For example:

=A2+B2

This formula adds the values stored in cells A2 and B2.

Another example is

=B2*C2

This formula multiplies the values in B2 and C2.

Basic Excel Formula Syntax

A simple formula generally follows this structure:

=Value1 Operator Value2

For example:

=100+50

Result:

150

We can also use cell references in a formula:

=A2+B2

Here, Excel adds the values stored in cells A2 and B2. When the values in these cells change, Excel automatically updates the formula result.

What Are Functions in Excel?

A function is a built-in formula in Excel that is designed to perform a specific calculation or task. Excel provides many functions that help us perform calculations, analyze data, work with text, handle dates, and perform other common operations.

For example:

=SUM(B2:B10)

The SUM function adds all the numbers from B2 to B10.

The general structure of a function is

=FUNCTION_NAME(argument1, argument2, ...)

For example:

=AVERAGE(B2:B10)

Here:

  • AVERAGE is the function name.
  • B2:B10 is the range supplied to the function.
  • The function calculates the average of the values in that range.

Difference Between Excel Formulas and Functions

Formulas and functions are related, but they are not exactly the same. Several differences between Excel formulas and functions are as follows:
 

FormulaFunctionDescription
Created using operators, cell references, values, or functionsPredefined by ExcelA formula can be created according to the calculation we need, while a function is already built into Excel.
Can be simple or complexPerforms a specific taskFormulas can contain simple calculations or multiple operations, while functions are designed for specific tasks.
Example: =A2+B2Example: =SUM(A2:A10)The first formula adds two cell values, while the SUM function adds values from a range.
Gives a calculated resultPerforms a predefined calculationBoth formulas and functions return a result based on the data provided.

Common Excel Formulas

Let us now look at the most commonly used formulas and functions for data analysis.

SUM Function

The SUM function is one of the most commonly used functions in Excel. It adds numbers from selected cells or ranges and returns their total. It is useful when we need to quickly calculate the total of a group of values without adding each value manually.

Syntax

=SUM(number1, [number2], ...)

Example

Suppose sales values are stored in cells B2 to B6.

=SUM(B2:B6)

This formula returns the total sales.

AVERAGE Function

The AVERAGE function calculates the arithmetic mean of numbers in selected cells or a range. It adds all the numbers and divides their total by the number of values. This function is commonly used in data analysis to find the average sales, marks, salary, expenses, or other numerical values in a dataset.

Syntax

=AVERAGE(number1, [number2], ...)

Example

=AVERAGE(B2:B10)

This returns the average value of the selected range.

MIN Function

The MIN function returns the smallest value from selected cells or a range. It is commonly used in data analysis to find the lowest sales, salary, marks, price, quantity, or other numerical value in a dataset.

Syntax

=MIN(number1, [number2], ...)

Example

=MIN(B2:B10)

This returns the smallest value from the selected range.

MAX Function

The MAX function returns the largest value from selected cells or a range. It is commonly used in data analysis to find the highest sales, salary, marks, price, quantity, or other numerical value in a dataset.

Syntax

=MAX(number1, [number2], ...)

Example

=MAX(B2:B10)

This returns the largest value from the selected range.

COUNT Function

The COUNT function counts the number of cells that contain numerical values in selected cells or a range. It is commonly used in data analysis to find the number of numeric records available in a dataset.

Syntax

=COUNT(value1, [value2], ...)

Example

=COUNT(B2:B20)

This returns the number of cells containing numbers in the selected range.

COUNTA Function

The COUNTA function counts the number of non-empty cells in selected cells or a range. Unlike the COUNT function, it can count cells containing numbers, text, dates, and other types of data.

Syntax

=COUNTA(value1, [value2], ...)

Example

=COUNTA(A2:A20)

This returns the number of non-empty cells in the selected range.

Conditional Functions for Data Analysis

Conditional functions are useful when we want Excel to perform calculations based on specific conditions.

IF Function

The IF function checks whether a specified condition is TRUE or FALSE and returns a different result based on the condition. It is commonly used in data analysis to classify data, compare values, and create results based on specific conditions.

Syntax

=IF(logical_test, value_if_true, value_if_false)

Example

=IF(B2>=50,"Pass","Fail")

If the value in B2 is 50 or greater, this formula returns Pass. Otherwise, it returns Fail.

COUNTIF Function

The COUNTIF function counts the number of cells that meet a specified condition. It is commonly used in data analysis to count records based on a particular value or criteria.

Syntax

=COUNTIF(range, criteria)

Example

=COUNTIF(C2:C100,"Delhi")

This returns the number of cells that contain Delhi in the selected range.

Another example is:

=COUNTIF(B2:B100,">50000")

This returns the number of cells containing values greater than 50,000.

COUNTIFS Function

The COUNTIFS function counts the number of cells or records that meet multiple conditions. It is useful when we need to analyze data based on two or more criteria.

Syntax

=COUNTIFS(criteria_range1, criteria1, criteria_range2, criteria2, ...)

Example

=COUNTIFS(B2:B100,"Delhi",C2:C100,">50000")

This counts the records where the city is Delhi and the value in column C is greater than 50,000.

SUMIF Function

The SUMIF function adds values that meet a specified condition. It is commonly used in data analysis to calculate the total for a particular category or value.

Syntax

=SUMIF(range, criteria, [sum_range])

Example

=SUMIF(A2:A100,"Laptop",C2:C100)

This adds the values from column C for the rows where column A contains Laptop.

SUMIFS Function

The SUMIFS function adds values that meet multiple conditions. It is useful when we need to calculate a total based on two or more criteria.

Syntax

=SUMIFS(sum_range, criteria_range1, criteria1, ...)

Example

=SUMIFS(D2:D100,B2:B100,"Delhi",C2:C100,"Laptop")

This calculates the total value from column D for records where the city is Delhi and the product is Laptop.

AVERAGEIF Function

The AVERAGEIF function calculates the average of values that meet a specified condition. It is commonly used in data analysis to find the average value for a particular category or group.

Syntax

=AVERAGEIF(range, criteria, [average_range])

Example

=AVERAGEIF(B2:B100,"Delhi",C2:C100)

This calculates the average value from column C for records where the city is Delhi.

AVERAGEIFS Function

The AVERAGEIFS function calculates the average of values that meet multiple conditions. It is useful when we need to find an average based on two or more criteria.

Syntax

=AVERAGEIFS(average_range, criteria_range1, criteria1, ...)

Example

=AVERAGEIFS(D2:D100,B2:B100,"Delhi",C2:C100,"Laptop")

This calculates the average sales value from column D for records where the city is Delhi and the product is Laptop.

Lookup Functions for Data Analysis

Lookup functions help us find information from a dataset based on a specific value.

XLOOKUP Function

The XLOOKUP function is used to find a specific value in one range and return the related value from another range. It is useful when we need to quickly find information in a dataset.

Syntax

=XLOOKUP(lookup_value, lookup_array, return_array)

Example

Suppose employee IDs are in column A and employee names are in column B.

=XLOOKUP(E2,A2:A100,B2:B100)

This formula searches for the employee ID entered in cell E2 in column A and returns the corresponding employee name from column B.

Why XLOOKUP Is Useful

XLOOKUP can be used to:

  • It is used to find employee details
  • It is used to find product prices
  • It matches the customer IDs
  • It retrieve the sales information
  • It is used to combine information from different datasets

VLOOKUP Function

VLOOKUP 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])

Example

=VLOOKUP(E2,A2:D100,4,FALSE)

This formula searches for the value in cell E2 in the first column of the selected table and returns the matching value from the fourth column.

INDEX and MATCH Functions

The INDEX and MATCH functions can be used together to find and return related information from a dataset. The MATCH function finds the position of a specific value, while the INDEX function uses that position to return the corresponding value.

Example

=INDEX(C2:C100,MATCH(E2,A2:A100,0))

Here:

  • MATCH finds the position of the lookup value.
  • INDEX returns the corresponding value.

Statistical Functions for Data Analysis

Statistical functions help us understand the distribution and characteristics of numerical data. Excel provides many statistical functions, including functions for averages, standard deviation, ranking, percentiles, and distributions.

MEDIAN Function

The MEDIAN function returns the middle value from a set of numbers. It is useful when a dataset contains extreme values that may affect the average. For example, when analyzing salaries, a few very high salaries can increase the average, while the median can give a better idea of the center of the data.

Syntax

=MEDIAN(number1, [number2], ...)

Example

=MEDIAN(B2:B20)

This returns the middle value from the selected range.

MODE Function

The MODE.SNGL function returns the value that occurs most frequently in a set of numbers. It is commonly used to find the most common value in a numerical dataset.

Syntax

=MODE.SNGL(number1, [number2], ...)

Example

=MODE.SNGL(B2:B20)

This returns the value that appears most often in the selected range.

LARGE Function

The LARGE function returns the k-th largest value from a range of numbers. It is useful when we need to find the highest, second-highest, third-highest, or another top value in a dataset.

Syntax

=LARGE(array, k)

Example

=LARGE(B2:B20,3)

This returns the third-largest value from the selected range.

It can be used to find:

  • Top 3 sales
  • Third-highest score
  • Top-performing values

SMALL Function

The SMALL function returns the k-th smallest value from a range of numbers. It is useful when we need to find the lowest, second-lowest, third-lowest, or another low value in a dataset.

Syntax

=SMALL(array, k)

Example

=SMALL(B2:B20,3)

This returns the third-smallest value from the selected range.

RANK.EQ Function

The RANK.EQ function determines the position of a number within a list of numbers. It is commonly used to rank sales, marks, scores, products, or other numerical values.

Syntax

=RANK.EQ(number, ref, [order])

Example

=RANK.EQ(B2,$B$2:$B$20,0)

This returns the rank of the value in B2 compared with the values in the selected range.

STDEV.S Function

The STDEV.S function calculates the standard deviation of a sample of values. It helps us understand how much the values vary around their average.

Syntax

=STDEV.S(number1, [number2], ...)

Example

=STDEV.S(B2:B20)

This calculates the standard deviation of the values in the selected range.

Percentage Formulas in Excel

Percentage calculations are commonly used in data analysis to compare values, measure growth, and understand performance.

Calculating Percentage

Suppose the achieved sales are stored in B2 and the target is stored in C2. We can calculate the percentage of the target that has been achieved using a simple formula.

Formula

=B2/C2*100

This calculates the percentage of the target that has been achieved.

It can be used to analyze:

  • Sales performance
  • Target achievement
  • Revenue
  • Expenses
  • Monthly performance

Calculating Percentage Change

The percentage change formula is used to compare an old value with a new value. It helps us understand whether a value has increased or decreased.

Formula

=(New_Value-Old_Value)/Old_Value*100

Example

=(C2-B2)/B2*100

This calculates the percentage change between the values in B2 and C2.

It can be used to analyze:

  • Sales growth
  • Revenue changes
  • Expense changes
  • Customer growth
  • Monthly performance

Excel Functions for Data Cleaning

Before analyzing a dataset, we often need to clean and standardize the data. Excel provides several text functions that can help remove unnecessary characters, spaces, and differences in text formatting.

TRIM Function

The TRIM function removes extra spaces from text. It is useful when data contains unnecessary spaces because of manual entry or imported data.

Syntax

=TRIM(text)

Example

=TRIM(A2)

This removes extra spaces from the text in cell A2.

CLEAN Function

The CLEAN function removes non-printable characters from text. It can be useful when data is copied or imported from external systems.

Syntax

=CLEAN(text)

Example

=CLEAN(A2)

This removes non-printable characters from the text in cell A2.

UPPER Function

The UPPER function converts text into uppercase letters. It is useful when we want to standardize text values in a dataset.

Syntax

=UPPER(text)

Example

=UPPER(A2)

This converts the text in cell A2 to uppercase.

LOWER Function

The LOWER function converts text into lowercase letters. It can be useful when standardizing text values before analysis.

Syntax

=LOWER(text)

Example

=LOWER(A2)

This converts the text in cell A2 to lowercase.

PROPER Function

The PROPER function changes the first letter of each word to uppercase and the remaining letters to lowercase. It is commonly used to format names, city names, and other text values.

Syntax

=PROPER(text)

Example

=PROPER(A2)

This changes the text in cell A2 to proper case.

These functions are useful for standardizing names, categories, cities, and other text fields before analysis.

Excel Functions for Unique and Filtered Data

Modern versions of Excel provide dynamic array functions that can help us work with unique, filtered, and sorted data more easily.

UNIQUE Function

The UNIQUE function returns a list of unique values from a range or array. It is useful when we need to find different customers, cities, products, or categories in a dataset.

Syntax

=UNIQUE(array)

Example

=UNIQUE(A2:A100)

This returns the unique values from the selected range.

It can be used to find:

  • Unique customers
  • Unique cities
  • Unique products
  • Unique categories

FILTER Function

The FILTER function returns only the records that meet a specified condition. It is useful when we need to display specific rows from a larger dataset.

Syntax

=FILTER(array, include, [if_empty])

Example

=FILTER(A2:D100,C2:C100="Delhi")

This returns the rows where the value in column C is Delhi.

We can also use multiple conditions. For example:

=FILTER(A2:D100,(B2:B100="Laptop")*(C2:C100="Delhi"))

This returns the records where the product is Laptop and the city is Delhi.

SORT Function

The SORT function sorts the values in a range or array. It can be used to arrange data in ascending or descending order.

Syntax

=SORT(array, [sort_index], [sort_order], [by_col])

Example

=SORT(A2:A20)

This sorts the values in ascending order.

We can also combine SORT with UNIQUE:

=SORT(UNIQUE(A2:A100))

This first returns the unique values and then sorts them.

Excel Date and Time Functions for Data Analysis

Date and time functions are useful when working with datasets that contain sales dates, order dates, employee records, website traffic, or other time-based information.

TODAY Function

The TODAY function returns the current date. It is useful when we need to use the current date in a calculation or report.

Syntax

=TODAY()

Example

=TODAY()

This returns the current date.

NOW Function

The NOW function returns the current date and time. It can be useful when both the date and time are required.

Syntax

=NOW()

Example

=NOW()

This returns the current date and time.

YEAR Function

The YEAR function extracts the year from a date.

Syntax

=YEAR(serial_number)

Example

=YEAR(A2)

This returns the year from the date stored in cell A2.

MONTH Function

The MONTH function extracts the month number from a date.

Syntax

=MONTH(serial_number)

Example

=MONTH(A2)

This returns the month number from the date stored in cell A2.

DAY Function

The DAY function extracts the day of the month from a date.

Syntax

=DAY(serial_number)

Example

=DAY(A2)

This returns the day from the date stored in cell A2.

These functions can help when analyzing data by year, month, or day.

IFERROR Function for Handling Errors

The IFERROR function allows us to display an alternative result when a formula returns an error. It is useful for keeping reports and analysis results clear when some calculations or lookups do not return a valid result.

Syntax

=IFERROR(value, value_if_error)

Example

=IFERROR(A2/B2,0)

If the calculation produces an error, this formula returns 0 instead.

Another example is:

=IFERROR(XLOOKUP(E2,A2:A100,B2:B100),"Not Found")

This returns Not Found when the lookup value is not found.

Combining Multiple Excel Functions

We can combine multiple Excel functions in a single formula to perform more than one operation. This is useful when the result depends on multiple calculations or conditions.

Example

=IF(AVERAGE(B2:B10)>=50,"Good","Needs Improvement")

Here, AVERAGE calculates the average of the values, and IF checks whether the average is 50 or greater.

Another example is:

=SORT(UNIQUE(A2:A100))

Here, UNIQUE returns the unique values, and SORT arranges those values in ascending order.

Combining functions allows us to perform multiple steps in one formula and makes data analysis easier.

Important Excel Formulas for Data Analysts

The following functions are especially useful to learn when working toward data analysis:

FunctionMain Use
SUMCalculate totals
AVERAGECalculate average
MINFind smallest value
MAXFind largest value
COUNTCount numerical values
COUNTACount non-empty cells
IFApply conditions
COUNTIFCount values based on one condition
COUNTIFSCount values based on multiple conditions
SUMIFAdd values based on one condition
SUMIFSAdd values based on multiple conditions
AVERAGEIFCalculate conditional average
AVERAGEIFSCalculate average using multiple conditions
XLOOKUPFind and return related values
VLOOKUPPerform vertical lookups
INDEXReturn a value from a position
MATCHFind the position of a value
MEDIANFind the middle value
MODE.SNGLFind the most common value
LARGEFind the k-th largest value
SMALLFind the k-th smallest value
RANK.EQRank values
STDEV.SCalculate sample standard deviation
TRIMRemove extra spaces
CLEANRemove non-printable characters
UPPERConvert text to uppercase
LOWERConvert text to lowercase
PROPERCapitalize words
IFERRORHandle formula errors
UNIQUEReturn unique values
FILTERFilter records using conditions
SORTSort data
TODAYReturn current date
YEARExtract year
MONTHExtract month
DAYExtract day

Practical Example of Excel Formulas for Data Analysis

Suppose we have a sales dataset with the following columns:

ProductRegionSalesQuantity
LaptopDelhi500002
MobileMumbai300005
LaptopDelhi650003
TabletPune250004
MobileDelhi400006

We can use different formulas to analyze this data.

Calculate Total Sales

=SUM(C2:C6)

Calculate Average Sales

=AVERAGE(C2:C6)

Find Highest Sale

=MAX(C2:C6)

Find Lowest Sale

=MIN(C2:C6)

Count Sales Records

=COUNT(C2:C6)

Calculate Delhi Sales

=SUMIF(B2:B6,"Delhi",C2:C6)

Count Laptop Records

=COUNTIF(A2:A6,"Laptop")

Find Unique Products

=UNIQUE(A2:A6)

Filter Delhi Sales

=FILTER(A2:C6,B2:B6="Delhi")

These formulas can quickly turn a simple dataset into useful information for analysis.

Conclusion

Excel formulas and functions are essential for working with data. They allow us to perform calculations, summarize information, apply conditions, find values, clean datasets, and extract useful insights. Learning these Excel formulas and functions step by step gives beginners a strong foundation for spreadsheet-based data analysis.