Formulas related to numbers, values, summaries
and statistics
Excel offers many functions when it comes to working with numeric values. Use below example
formulas and functions to work efficiently with numbers. Learn how to calculate count, sum, average
and other statistical summaries from your data. Apart from the functions discussed here, you can also
use operators like + (to add things), -(to subtract), *(to multiply), /(to divide), %(to convert a value
to percentage), ^(to raise the power), ~(to negate a Boolean value) and brackets to create
expressions.
Add some values
Example =SUM(5,6,9)
Result 20
Add values from a range of cells
Example =SUM(A1:A5)
Result 125
Sum up values from a table reference
Example =SUM(staff[Salary])
Result $ 945,000
Sum of numbers that meet conditions
Example =SUMIFS(staff[Salary], staff[Department],"Sales")
Result $ 279,000
Learn more about this formula: SUMIFS formula
Sum of numbers greater than (less than etc.) something
Example =SUMIFS(A1:A6, A1:A6,">25")
Result 100
Learn more about this formula: SUMIFS formula
Sum of numbers that are currently filtered
Example =SUBTOTAL(109,staff[Salary])
Result $ 945,000
Learn more about this formula: SUBTOTAL function
Count of numbers that are currently filtered
Example =SUBTOTAL(103,staff[Name])
Result 13
Learn more about this formula: SUBTOTAL function
Running total in a column, adjacent to original data
Type this formula in first cell and drag down to get running total.
Example =SUM($A$1:A1)
Result 10
Count of numbers in a range
Example =COUNT(A1:A6)
Result 6
Count of all values (including text)
Example =COUNTA(staff[Name])
Result 13
Count of blank values in the input (range or table column)
Example =COUNTBLANK(A1:A20)
Result 14
Count number of non-blank values
ROWS formula tells how rows are there in a range. You can also use COLUMNS
Example =ROWS(A1:A20)-COUNTBLANK(A1:A20)
Result 6
Count how many items have met given conditions
Example =COUNTIFS(staff[Department],"IT")
Result 3
Count how many items begin with given text
* is a wild card. You can use it to match any number of letters. If you want to match a single
letter, use ?
Example =COUNTIFS(staff[Name],"J*")
Result 13
Count how many items end with given pattern
Example =COUNTIFS(staff[Name],"*n")
Result 4
Count how many items contain given word
Example =COUNTIFS(staff[Name],"*an*")
Result 3
Average of given numbers
Example =AVERAGE(staff[Salary])
Result $ 72,692
Learn more about this formula: More about Averages in your analysis
Average of given numbers satisfying conditions
Example =AVERAGEIFS(staff[Salary],staff[Department], "HR")
Result $ 77,333
Average of positive numbers
Example =AVERAGEIFS(A1:A10,A1:A10,">0")
Result 25.83
Average of numbers excluding top & bottom 10% values
Example =TRIMMEAN(staff[Salary],10%)
Result $ 72,692
7 day moving average from daily data
Type this formula in first cell and drag down to get moving average.
Example =AVERAGE(A1:A7)
Result 25.83
Learn more about this formula: Moving Average in Excel
Weighted average of numbers
A1:A6 contain values and B1:B6 contain weights
Example =SUMPRODUCT(A1:A6,B1:B6)
Result 2,550
Learn more about this formula: Weighted Average Formula
Median of a range of values
Example =MEDIAN(staff[Salary])
Result $ 76,000
Most frequent number in a range (MODE)
If your list has multiple MODEs, use MODE.MULT to return all of them as a new list.
Example =MODE.SNGL(1,2,3,3,2,1,1,5,6,7,3,4,8,9)
Result 1
Statistical quartiles of given values
Use 1 for first quartile, 2 for median, 3 for third quartile. EXC means 0 & 1 are excluded
when calculating quartiles.
Example =QUARTILE.EXC(staff[Salary],1)
Result $ 59,500
90th (or any other) percentile of given values
Example =PERCENTILE.EXC(staff[Salary],0.9)
Result $ 89,000
Minimum value among a list of numbers
Example =MIN(A1:A6)
Result 10
3rd smallest (or any other) among a list
Example =SMALL(staff[Salary],3)
Result $ 59,000
Rank of a number in a list of values
If two numbers share a rank, then the rank will be averaged. Use RANK.EQ to return same
rank for both numbers
Example =RANK.AVG(76000, staff[Salary])
Result 7
Maximum value from a list of values
Example =MAX(staff[Salary])
Result $ 89,000
2nd largest value in a spreadsheet range
Example =LARGE(A2:A7,2)
Result 30
Formulas to do operations on numbers
Whenever you have some numbers in a worksheet, you may want to run some operations like
rounding them or extracting integer portion etc. on them. In this section, see some of the frequently
used number operations.
Remainder after dividing two numbers
Example =MOD(31,7)
Result 3
Round a number to nearest whole number or fraction
Example =ROUND(PI(),4)
Result 3.1416
Round a number to nearest multiple of x
Example =MROUND(27,4)
Result 28
Integer portion of a number
Example =INT(19/7)
Result 2
Percentage change (variance) from one value to another
H4 is 35000, H5 is 38000
Example =H5/H4-1
Result 8.57%
Decimal portion of a number
Example =MOD(PI(),1)
Result 0.141592654
Absolute value of a number
Example =ABS(30-43)
Result 13
Calculate power of one number to another
Example =7^3
Result 343
Formulas related to check things, apply business
rules and logic control
Microsoft Excel has several powerful functions to check things and set up control or business logic in
your workbooks. You can use IF function to write simple logic expressions or nest multiple IF functions
for more complex scenarios. You can also use newly introduced IFS function to write long multi-step if
function. This only works in Office 365 or Excel online. See below examples to learn more about
formulas and functions to check things and apply business rules.
Check a condition and output one of the two possible values
Example =IF(A9>20,"Too high", "Too low")
Result Too low
Learn more about this formula: Writing logical rules in Excel
Check if multiple conditions are true (AND)
Example =AND(A9>5,B9<20)
Result FALSE
Check if any condition is true (OR)
Example =OR(E10="Sales", F10>90000, D10=A9)
Result FALSE
Logical NOT check
Example =NOT("Sam"="Samuel")
Result TRUE
Check if either this or that (Exclusive OR)
Will be TRUE only if either A1>10 or B1>10 but not both or neither.
Example =XOR(A9>10, B9>10)
Result FALSE
Learn more about this formula: More on XOR
Select one among multiple values
Picks a value from a list of values, in this case, picks A2 as it is the 3rd value.
Example =CHOOSE(3,A9,B10,A10,B11)
Result 0
Learn more about this formula: CHOOSE Function
Multiple IF conditions as IFS
A9 has 7. Works only in Office 365, Office online (and may be in Excel 2019)
Example =ifs(A9>10, "This is too high", A9>5, "This is ok", A9>2,"Almost
low", A9<=2,"Really low")
Result This is ok
Check if a value is present in a list
Example =IF(COUNTIFS(staff[Name],"Jan")>0,"Yes, Jan is in there","No, no such
person")
Result Yes, Jan is in there
Check multiple conditions as nested IF
Example =IF(A9>10, "This is too high",IF( A9>5, "This is ok", IF(A9>2,"Almost
low", "Really low")))
Result Really low
Check if a value is between two other values
Example =IF(AND(A9>=10,A9<=20),"Between 10 and 20","Nope, not between 10 and
20")
Result Nope, not between 10 and 20
Learn more about this formula: Between Formula
Is a cell blank?
Example =ISBLANK(A18)
Result TRUE
Is a value even?
Example =ISEVEN(7)
Result FALSE
Is a value odd?
Example =ISODD(7)
Result TRUE
Is a cell contains number?
Example =ISNUMBER(A9)
Result FALSE
Is a cell contains formula?
Example =ISFORMULA(A9)
Result FALSE
Is a cell (or formula) ends up in error?
Example =ISERROR(7/0)
Result TRUE
Formulas to work with text values, strings, words
and phrases
While Excel is predominantly a number driven tool, we still have lots of text values in spreadsheets.
Excel has many powerful and elegant text processing functions to help you extract, analyze or
understand your text / string values. You can use the special operator & to combine text values or
even work with newly introduced TEXTJOIN() function to combine a range of values to one. Keep in
mind, this TEXTJOIN only works in Office 365 or Excel Online at the moment. In the below examples,
know how to work with string / text values in your workbooks using formulas.
Convert text to lower case
Example =LOWER("hello")
Result hello
Convert text to upper case
Example =UPPER(D3)
Result JAMES
Convert text to proper case (each word's first letter capitalized)
Example =PROPER("this is a long sentence")
Result This Is A Long Sentence
Combine different text values to one text
Example =CONCATENATE(A3, " and ", A4)
Result 30 and 25
Combine different text values to one text
Example =A3&" and "&A4
Result 30 and 25
Extract first few letters from a text
Example =LEFT("India",3)
Result Ind
Extract last few letters from a text
Example =RIGHT("New Zealand",4)
Result land
Extract middle portion from given text
Example =MID("United States",4,5)
Result ted S
What is the length of given text value
Example =LEN("Chandoo.org")
Result 11
Substitute one word with another
Example =SUBSTITUTE("Microsoft Excel","cel","cellent")
Result Microsoft Excellent
Replace some letters with other
Example =REPLACE("abc@email.com",5,1,"g")
Result abc@gmail.com
Find if a text has another text
Example =FIND("soft","Microsoft Excel")
Result 6
Extract initials from a name
H1 contains Bill Jelen
Example =LEFT(H1,1)&MID(H1,FIND(" ",H1)+1,1)
Result BJ
Find out how many words are in a sentence
H2 contains "This is a very long sentence with lots of words"
Example =LEN(H2)-LEN(SUBSTITUTE(H2," ",""))+1
Result 10
Remove unnecessary spaces from a cell
Example =TRIM(" chandoo. org ")
Result chandoo. org
Remove anything after a symbol or word
H3 contains someone@something.com
Example =LEFT(H3,FIND("@",H3)-1)
Result someone
Formulas to work with date, time and calendar
Date and time values are very important when working with business data. That is why, Excel has
many functions in this space. You can use TODAY() to figure out what is the current date or use
DATE() to generate a date that you want. In the below examples, learn how to calculate some of the
most common date and time related stuff using Excel.
What is today's date?
Example =TODAY()
Result 6/27/2018
What is the current date & time?
Example =NOW()
Result 6/27/2018 12:00
Create a date value from year, month and day
Example =DATE(2018,10,20)
Result 10/20/2018
Learn more about this formula: Working with date & time values in Excel
Create a time value from hour, minute and second
Example =TIME(9,45,21)
Result 9:45 AM
Learn more about this formula: Working with date & time values in Excel
Get day of month from given date
Example =DAY(TODAY())
Result 27
Learn more about this formula: Working with date & time values in Excel
What month is a given date on?
Example =MONTH(DATEVALUE("12-July-1999"))
Result 7
Learn more about this formula: Working with date & time values in Excel
Extract year from a date
Example =YEAR(TODAY())
Result 2018
Learn more about this formula: Working with date & time values in Excel
Find out day of week (number) from a date
Example =WEEKDAY(TODAY())
Result 4
Learn more about this formula: Working with date & time values in Excel
Find out day of week (name of the day) from a date
Use DDD to see short form of day name, such as SUN, MON etc.
Example =TEXT(TODAY(), "DDDD")
Result Wednesday
Learn more about this formula: Working with date & time values in Excel
What is the name of a month from a date?
Use MMM to see short form of month name, such as Jan, Feb etc.
Example =TEXT(TODAY(), "MMMM")
Result June
Learn more about this formula: Working with date & time values in Excel
Hour from time
Example =HOUR(NOW())
Result 12
Learn more about this formula: Working with date & time values in Excel
Minute from time
Example =MINUTE(NOW())
Result 0
Learn more about this formula: Working with date & time values in Excel
Second from time
Example =SECOND(NOW())
Result 2
Learn more about this formula: Working with date & time values in Excel
What is the date after / before x months
Example =EDATE(TODAY(),3)
Result 9/27/2018
Learn more about this formula: Working with date & time values in Excel
What is the last date of a month?
Example =EOMONTH(DATE(2018,8,1),0)
Result 8/31/2018
Learn more about this formula: Working with date & time values in Excel
Calculate number of days between two dates
Example =DATE(2018,12,1)-DATEVALUE("1-july-2018")
Result 153
Learn more about this formula: Working with date & time values in Excel
Calculate number of years between two dates
You can also use (date1-date2)/365 to calculate number of years between 2 dates
Example =YEARFRAC(DATE(2009,9,24),TODAY(),1)
Result 8.76
Learn more about this formula: Working with date & time values in Excel
Number of weeks between two dates
Example =INT((DATE(2018,12,1)-DATEVALUE("1-july-2018"))/7)
Result 21
Learn more about this formula: Working with date & time values in Excel
What is the date after / before x working days (excluding
weekends etc.)
This assumes Saturday & Sunday are weekends. If you have some other workweek pattern,
use the 3rd parameter of WORKDAY.INTL to specify that. Likewise, you can also specify a list
of special holidays (New Years Day, Diwali, Ramadan or Christmas etc.) to exclude them too
Example =WORKDAY.INTL(TODAY(),12)
Result 7/13/2018
Learn more about this formula: Working with date & time values in Excel
How many working days are between two dates?
This assumes Saturday & Sunday are weekends. If you have some other workweek pattern,
use the 3rd parameter of NETWORKDAYS.INTL to specify that. Likewise, you can also specify
a list of special holidays (New Years Day, Diwali, Ramadan or Christmas etc.) to exclude
them too
Example =NETWORKDAYS.INTL(TODAY(),DATE(2018,12,31))
Result 134
Learn more about this formula: Working with date & time values in Excel
Formulas to lookup items
Lookup functions help us answer specific questions from business data, like which customer placed the
order number PQ1234? You can use them to ask simple questions or combine lookup functions with
other formulas in Excel to find more complex things. In these examples, learn how to write some of
the most common lookup functions in Excel.
Lookup a value in a table and find corresponding items (example,
salary of an employee)
Finds John in the staff table's first column and returns value from 3rd column (salary)
Example =VLOOKUP("John", staff, 3, FALSE)
Result $ 77,000
Learn more about this formula: All you want to know about VLOOKUP
Lookup a pattern in a table and find corresponding items
(example, salary of an employee)
Example =VLOOKUP("Jon*", staff,2,FALSE)
Result Production
Learn more about this formula: VLOOKUP with wild cards
What is the position of a value in a list?
Example =MATCH(76000,staff[Salary],0)
Result 10
Learn more about this formula: Using MATCH formula
Formulas to convert one data to another type of
data
Often, we end up having data that is not in the right format to do our job. You can use conversion
formulas to change data from one type to another.
Convert a cell to number
Here . Is the thousand's separator and , is decimal point (i.e. European notation)
Example =NUMBERVALUE("123.456,78",",",".")
Result 123,456.78
Convert a value to date
Example =DATEVALUE("1-jul-2018")
Result 7/1/2018
Convert a cell to number (another technique)
You can also +0 to a text value to convert it to number.
Example ="12456.78"*1
Result 12,456.78
Formulas to check and prevent errors
We can't escape bad coffee, occasionally annoying bosses and errors. Of course, Excel can't help you
with first two, but it does a fine job of handling errors for us. Learn how to use the important error
handling and checking functions in Excel.
Show a different value if a formula has an error
Example =IFERROR(VLOOKUP("Sam",staff,3,FALSE),"Employee not found")
Result Employee not found
Learn more about this formula: IFERROR
Show a different value if a formula has an NA error
Example =IFNA(7/0,"This will appear if the error is #N/A")
Result #DIV/0!
Is a cell (or formula) ends up in error?
Example =ISERROR(7/0)
Result TRUE
Safely divide one number with another
Example =IF(A2=0,"",A1/A2)
Result 0.5
Formulas to generate randomized data
Once in a while you need to generate or create random data in Excel. You can use either RAND() or
RANDBETWEEN() to complete the job. In these examples, learn how to create most common types of
random data using Excel.
Generate a random number
The output changes every time you make a change in your spreadsheet.
Example =RAND()
Result 0.948708709
Generate a random phone number
The output changes every time you make a change in your spreadsheet.
Example =RANDBETWEEN(1000000000,9999999999)
Result (535) 050-1262
Generate a random letter from alphabet
The output changes every time you make a change in your spreadsheet.
Example =CHAR(RANDBETWEEN(CODE("A"),CODE("Z")))
Result Z
Create a random option from a list of values
The output changes every time you make a change in your spreadsheet.
Example =INDEX(staff[Name], RANDBETWEEN(1,COUNTA(staff[Name])))
Result June
Source: https://chandoo.org/wp/excel-formula-list/