Advanced Excel formulas are essential for tackling complex tasks, manipulating large datasets, performing in-depth calculations, and analyzing data more efficiently. Here are some advanced Excel formulas with explanations and examples:
Array formulas allow you to perform multiple calculations on one or more items in an array and return either a single result or multiple results.
To sum the products of two columns (e.g., Column A and Column B):
=SUM(A1:A5 * B1:B5)
This is an array formula, and you need to press Ctrl + Shift + Enter to execute it. It multiplies each corresponding value in columns A and B and sums the results.
The combination of INDEX
and MATCH
is a more flexible alternative to VLOOKUP
and HLOOKUP
. It allows you to look up a value in any column or row, regardless of its position.
=INDEX(return_range, MATCH(lookup_value, lookup_range, 0))
This is an array formula, and you need to press Ctrl + Shift + Enter to execute it. It multiplies each corresponding value in columns A and B and sums the results.
These functions are used to sum, count, or average values based on multiple criteria. SUMIFS
can sum values in a range based on multiple conditions.
SUMIFS
:Suppose you have a table of sales data:
To sum the sales amount for the product “Apple” in the “East” region:
=SUMIFS(B1:B10, A1:A10, "Apple", C1:C10, "East")
The IFERROR
function helps you handle errors in formulas gracefully, replacing error values with something else (like 0 or a custom message).
=IFERROR(formula, value_if_error)
If you are dividing values in A1
and B1
, but you want to avoid a #DIV/0!
error when B1
is zero:
=IFERROR(A1 / B1, "Division Error")
The OFFSET
function returns a reference to a range that is offset from a starting point, and it can be combined with other functions to create dynamic ranges.
=OFFSET(reference, rows, cols, [height], [width])
If you want to sum the last 5 entries in a column (e.g., column B
):
=SUM(OFFSET(B1, COUNTA(B:B)-5, 0, 5, 1))
This sums the last 5 rows of column B.
The INDIRECT
function returns a cell reference specified by a text string. It is useful when you want to dynamically refer to a range or cell.
=INDIRECT(ref_text, [a1])
If you want to refer to cell “B2” dynamically by changing the reference in A1
, you can use:
=INDIRECT(A1)
If A1
contains the text “B2”, this formula will return the value in cell B2
.
The TEXT
function allows you to apply custom formatting to a number or date as text.
=TEXT(value, format_text)
To format the number 12345
as currency with a comma separator:
=TEXT(12345, "$#,##0.00")
To display the current date in a custom format:
=TEXT(TODAY(), "dd-mm-yyyy")
The TRANSPOSE
function changes the orientation of a range of cells, converting rows to columns and vice versa.
=TRANSPOSE(array)
To transpose the data from cells A1:A3
to a horizontal range:
=TRANSPOSE(A1:A3)
This will convert the vertical range A1:A3
into a horizontal range.
The SUMPRODUCT
function multiplies corresponding elements in the given arrays and returns the sum of those products. It’s useful for conditional summing.
=SUMPRODUCT(array1, array2, ...)
Suppose you have two columns:
To calculate the total sales, you would use:
=SUMPRODUCT(A1:A5, B1:B5)
This will multiply each quantity by the corresponding price and sum the results.
CONCATENATE
is an old function (still works but replaced by TEXTJOIN
in newer versions of Excel). It joins multiple text values into one cell.TEXTJOIN
is more powerful and allows specifying a delimiter.TEXTJOIN
:To combine first name (in A1) and last name (in B1), separated by a space:
=TEXTJOIN(" ", TRUE, A1, B1)
Here, TRUE
ignores any empty cells.
XLOOKUP
is a modern replacement for VLOOKUP
and HLOOKUP
. It’s more flexible, allowing you to search both vertically and horizontally.
=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])
To search for the price of a product in column A
and return the corresponding price from column B
:
=XLOOKUP("Apple", A1:A5, B1:B5, "Not Found")
The POWER
function returns the result of a number raised to a specified power.
=POWER(number, power)
To calculate 5 raised to the power of 3:
=POWER(5, 3)
This will return 125
.
The EOMONTH
function returns the last day of the month, a specified number of months before or after a given date.
=EOMONTH(start_date, months)
To find the last day of the month, 3 months after 2024-01-01
:
=EOMONTH("2024-01-01", 3)
This will return 2024-04-30
.
The NETWORKDAYS
function calculates the number of working days (excluding weekends and holidays) between two dates.
=NETWORKDAYS(start_date, end_date, [holidays])
To calculate the number of working days between January 1st, 2024, and January 10th, 2024, excluding the holiday on January 5th:
=NETWORKDAYS("2024-01-01", "2024-01-10", {"2024-01-05"})
Using IF
with AND
or OR
allows for more complex conditions.
IF
+ AND
:If you want to check if a student has both passed Math and Science (marks >= 50):
=IF(AND(A2 >= 50, B2 >= 50), "Pass", "Fail")
IF
+ OR
:If you want to check if a student has passed either Math or Science:
=IF(OR(A2 >= 50, B2 >= 50), "Pass", "Fail")