SUM
Syntax: SUM(number1, [number2], …)
Adds numbers or whole ranges.
=SUM(Data!G2:G13)Result with the sample data: 486,000
Watch out: Numbers stored as text are skipped without any warning. Compare COUNT with COUNTA to find them.
All versions
44 formulas for sales, operations and HR reporting. Each has the syntax, a worked example on the same sample data, the result and the mistake to avoid.
All examples read from this sheet, named "Data", so you can check any result by hand.
| A | B | C | D | E | F | G | H | J | |
|---|---|---|---|---|---|---|---|---|---|
| 1 | Region | Rep | Month | Product | Units | Unit price | Sales | Target | Order date |
| 2 | North | Ali | Jan | Tea | 120 | 450 | 54,000 | 50,000 | 2026-01-05 |
| 3 | North | Sara | Jan | Juice | 80 | 300 | 24,000 | 30,000 | 2026-01-12 |
| 4 | South | Omar | Jan | Tea | 150 | 450 | 67,500 | 60,000 | 2026-01-18 |
| 5 | East | Hina | Jan | Biscuits | 200 | 120 | 24,000 | 20,000 | 2026-01-25 |
| 6 | North | Ali | Feb | Juice | 95 | 300 | 28,500 | 30,000 | 2026-02-03 |
| 7 | North | Sara | Feb | Tea | 110 | 450 | 49,500 | 45,000 | 2026-02-10 |
| 8 | South | Omar | Feb | Biscuits | 300 | 120 | 36,000 | 40,000 | 2026-02-16 |
| 9 | East | Hina | Feb | Tea | 90 | 450 | 40,500 | 45,000 | 2026-02-24 |
| 10 | North | Ali | Mar | Biscuits | 250 | 120 | 30,000 | 25,000 | 2026-03-04 |
| 11 | North | Sara | Mar | Juice | 130 | 300 | 39,000 | 35,000 | 2026-03-11 |
| 12 | South | Omar | Mar | Juice | 70 | 300 | 21,000 | 30,000 | 2026-03-19 |
| 13 | East | Hina | Mar | Tea | 160 | 450 | 72,000 | 60,000 | 2026-03-27 |
Column I in the workbook is hidden. Names and figures are made up for practice.
| A | B | C | E | |
|---|---|---|---|---|
| 1 | Product | Category | List price | Messy name |
| 2 | Tea | Beverage | 450 | ali raza |
| 3 | Juice | Beverage | 300 | |
| 4 | Biscuits | Snack | 120 |
44 formulas
Syntax: SUM(number1, [number2], …)
Adds numbers or whole ranges.
=SUM(Data!G2:G13)Result with the sample data: 486,000
Watch out: Numbers stored as text are skipped without any warning. Compare COUNT with COUNTA to find them.
All versions
Syntax: SUMIF(range, criteria, [sum_range])
Adds the values that meet one condition.
=SUMIF(Data!A2:A13,"North",Data!G2:G13)Result with the sample data: 225,000
Watch out: The sum range comes last here, but first in SUMIFS.
All versions
Syntax: SUMIFS(sum_range, criteria_range1, criteria1, …)
Adds the values that meet several conditions at once.
=SUMIFS(Data!G2:G13,Data!A2:A13,"North",Data!C2:C13,"Jan")Result with the sample data: 78,000
Watch out: Every range must be the same size, or the formula returns #VALUE!.
Excel 2007 and later
Syntax: COUNT(value1, [value2], …)
Counts the cells that contain numbers.
=COUNT(Data!E2:E13)Result with the sample data: 12
Watch out: Text that looks like a number is not counted.
All versions
Syntax: COUNTA(value1, [value2], …)
Counts the cells that are not empty.
=COUNTA(Data!B2:B13)Result with the sample data: 12
Watch out: A cell holding an empty text result ("") still counts as filled.
All versions
Syntax: COUNTIF(range, criteria)
Counts the cells that meet one condition.
=COUNTIF(Data!D2:D13,"Tea")Result with the sample data: 5
Watch out: Put comparisons in quotes, for example ">100".
All versions
Syntax: COUNTIFS(criteria_range1, criteria1, …)
Counts the rows that meet several conditions.
=COUNTIFS(Data!A2:A13,"North",Data!G2:G13,">30000")Result with the sample data: 3
Watch out: To compare with a cell, join the sign and the cell: ">"&H1.
Excel 2007 and later
Syntax: AVERAGE(number1, [number2], …)
Returns the arithmetic mean.
=AVERAGE(Data!G2:G13)Result with the sample data: 40,500.00
Watch out: Empty cells are ignored but zeros are included, which changes the result.
All versions
Syntax: AVERAGEIFS(average_range, criteria_range1, criteria1, …)
Averages only the rows that meet your conditions.
=AVERAGEIFS(Data!G2:G13,Data!D2:D13,"Tea")Result with the sample data: 56,700.00
Watch out: If nothing matches, the result is #DIV/0!.
Excel 2007 and later
Syntax: MAX(number1, [number2], …)
Returns the largest value.
=MAX(Data!G2:G13)Result with the sample data: 72,000
Watch out: Text and empty cells are ignored.
All versions
Syntax: MIN(number1, [number2], …)
Returns the smallest value.
=MIN(Data!G2:G13)Result with the sample data: 21,000
Watch out: A zero used as a placeholder will become the minimum.
All versions
Syntax: MAXIFS(max_range, criteria_range1, criteria1, …)
Returns the largest value among rows that meet your conditions.
=MAXIFS(Data!G2:G13,Data!A2:A13,"South")Result with the sample data: 67,500
Watch out: It returns 0, not an error, when nothing matches.
Excel 2019 or Microsoft 365
Syntax: SUBTOTAL(function_num, ref1, …)
Totals a list and ignores rows hidden by a filter. Function 9 means sum.
=SUBTOTAL(9,Data!G2:G13)Result with the sample data: 486,000
Watch out: Use 109 instead of 9 to also ignore rows you hid by hand.
All versions
Syntax: SUMPRODUCT(array1, [array2], …)
Multiplies matching items and adds the results.
=SUMPRODUCT(Data!E2:E13,Data!F2:F13)Result with the sample data: 486,000
Watch out: The arrays must have the same number of rows and columns.
All versions
Syntax: VLOOKUP(lookup_value, table_array, col_index_num, FALSE)
Finds a value in the first column of a table and returns a value from the same row.
=VLOOKUP("Juice",Lookup!A2:C4,3,FALSE)Result with the sample data: 300
Watch out: Leaving out FALSE gives an approximate match, which can return a wrong value without warning.
All versions
Syntax: INDEX(return_range, MATCH(lookup_value, lookup_range, 0))
Looks up in any direction and works in every version.
=INDEX(Lookup!A2:A4,MATCH(120,Lookup!C2:C4,0))Result with the sample data: Biscuits
Watch out: Keep both ranges the same height and use 0 for an exact match.
All versions
Syntax: XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found])
A modern lookup that can search left or right and shows your own message when nothing is found.
=XLOOKUP("Coffee",Lookup!A2:A4,Lookup!C2:C4,"Not found")Result with the sample data: Not found
Watch out: It is not available in Excel 2019 or earlier. Use INDEX and MATCH for older versions.
Excel 2021 or Microsoft 365
Syntax: IF(logical_test, value_if_true, value_if_false)
Chooses between two results.
=IF(Data!G2>=Data!H2,"Met","Missed")Result with the sample data: Met
Watch out: Put text results in quotes.
All versions
Syntax: IFS(test1, value1, test2, value2, …)
Checks conditions in order and returns the first that is true.
=IFS(Data!G3>=Data!H3,"Met",Data!G3>=Data!H3*0.8,"Close",TRUE,"Missed")Result with the sample data: Close
Watch out: End with TRUE as the catch-all, or unmatched rows show #N/A.
Excel 2019 or Microsoft 365
Syntax: AND(logical1, [logical2], …)
True only when every condition is true.
=IF(AND(Data!E2>100,Data!G2>50000),"Yes","No")Result with the sample data: Yes
Watch out: AND gives one answer for a whole range; it does not test row by row.
All versions
Syntax: OR(logical1, [logical2], …)
True when at least one condition is true.
=IF(OR(Data!A2="East",Data!D2="Tea"),"Yes","No")Result with the sample data: Yes
Watch out: Repeat the cell for each test: OR(A2="North",A2="East"), not OR(A2="North","East").
All versions
Syntax: IFERROR(value, value_if_error)
Shows your own result instead of an error.
=IFERROR(Data!G2/0,0)Result with the sample data: 0
Watch out: It hides every error, including broken references. For lookups, show a visible message instead of 0.
All versions
Syntax: TRIM(text)
Removes extra spaces, leaving single spaces between words.
=TRIM(Lookup!E2)Result with the sample data: ali raza
Watch out: It does not remove non-breaking spaces copied from web pages.
All versions
Syntax: PROPER(text)
Capitalises the first letter of each word.
=PROPER(TRIM(Lookup!E2))Result with the sample data: Ali Raza
Watch out: Names such as McDonald need a manual check.
All versions
Syntax: UPPER(text)
Changes text to capital letters.
=UPPER(Data!A2)Result with the sample data: NORTH
Watch out: Lookups already ignore capitals, so this is for display.
All versions
Syntax: LEFT(text, [num_chars])
Takes characters from the start of a text.
=LEFT(Data!D5,3)Result with the sample data: Bis
Watch out: The result is text, even when it looks like a number.
All versions
Syntax: MID(text, start_num, num_chars)
Takes characters from the middle of a text.
=MID("GM-2026-014",4,4)Result with the sample data: 2026
Watch out: Positions start at 1, and spaces count.
All versions
Syntax: LEN(text)
Counts the characters in a cell.
=LEN(TRIM(Lookup!E2))Result with the sample data: 8
Watch out: Compare with LEN of the untrimmed cell to find hidden spaces.
All versions
Syntax: SUBSTITUTE(text, old_text, new_text, [instance_num])
Replaces one piece of text with another.
=SUBSTITUTE("0300-123-4567","-","")Result with the sample data: 03001234567
Watch out: It is case-sensitive.
All versions
Syntax: TEXTJOIN(delimiter, ignore_empty, text1, …)
Joins many cells with a separator.
=TEXTJOIN(", ",TRUE,Lookup!A2:A4)Result with the sample data: Tea, Juice, Biscuits
Watch out: Set the second argument to TRUE to skip empty cells.
Excel 2019 or Microsoft 365
Syntax: TEXT(value, format_text)
Turns a number or date into text in a chosen format.
=TEXT(Data!G2,"#,##0")Result with the sample data: 54,000
Watch out: The result is text and cannot be summed. Format codes can differ with regional settings.
All versions
Syntax: EOMONTH(start_date, months)
Returns the last day of a month, before or after a date.
=EOMONTH(Data!J2,0)Result with the sample data: 2026-01-31
Watch out: Format the result cell as a date, or you will see a serial number.
All versions
Syntax: NETWORKDAYS(start_date, end_date, [holidays])
Counts Monday to Friday between two dates, including both ends.
=NETWORKDAYS(DATE(2026,3,1),DATE(2026,3,31))Result with the sample data: 22
Watch out: For Friday and Saturday or Sunday-only weekends, use NETWORKDAYS.INTL.
All versions
Syntax: DATEDIF(start_date, end_date, unit)
Counts complete years or months between two dates.
=DATEDIF(DATE(2022,6,15),DATE(2026,11,25),"Y")Result with the sample data: 4
Watch out: Excel does not suggest it as you type. Microsoft advises against the "MD" unit.
All versions
Syntax: WEEKDAY(date, [return_type])
Returns the day of the week as a number. With type 2, Monday is 1.
=WEEKDAY(Data!J2,2)Result with the sample data: 1
Watch out: Without the second argument, Sunday is 1.
All versions
Syntax: actual / target
Shows how much of a target has been reached.
=SUM(Data!G2:G13)/SUM(Data!H2:H13)Result with the sample data: 103.4%
Watch out: For a team, divide total actual by total target. Do not average each person's percentage.
All versions
Syntax: (new - old) / old
Measures change from one period to the next.
=(SUMIFS(Data!G2:G13,Data!C2:C13,"Mar")-SUMIFS(Data!G2:G13,Data!C2:C13,"Feb"))/SUMIFS(Data!G2:G13,Data!C2:C13,"Feb")Result with the sample data: 4.9%
Watch out: If the old value is zero or negative, the percentage has no useful meaning.
All versions
Syntax: SUMPRODUCT(values, weights) / SUM(weights)
Averages values where some count more than others. Here, the average selling price per unit.
=SUMPRODUCT(Data!F2:F13,Data!E2:E13)/SUM(Data!E2:E13)Result with the sample data: 276.92
Watch out: A simple average of prices ignores how many units were sold at each price.
All versions
Syntax: SUM($G$2:G2) copied down
Adds up values as you go down a list. The example is the total after six rows.
=SUM(Data!$G$2:G7)Result with the sample data: 247,500
Watch out: Lock only the starting cell with $ so the end moves as you copy.
All versions
Syntax: RANK(number, ref, [order])
Shows the position of a number in a list.
=RANK(Data!G2,Data!$G$2:$G$13,0)Result with the sample data: 3
Watch out: Lock the list with $. Equal values get the same rank.
All versions
Syntax: LARGE(array, k)
Returns the k-th largest value.
=LARGE(Data!G2:G13,3)Result with the sample data: 54,000
Watch out: k cannot be larger than the number of values.
All versions
Syntax: ROUND(number, num_digits)
Rounds to a chosen number of decimal places. Negative places round to tens, hundreds or thousands.
=ROUND(AVERAGE(Data!G2:G13),-2)Result with the sample data: 40,500
Watch out: Formatting hides decimals but keeps them. ROUND changes the stored value.
All versions
Syntax: FILTER(array, include, [if_empty])
Returns the rows that meet a condition. Here the results are added up.
=SUM(FILTER(Data!G2:G13,Data!A2:A13="East"))Result with the sample data: 136,500
Watch out: It needs empty cells below and beside it, or it shows #SPILL!.
Excel 2021 or Microsoft 365
Syntax: UNIQUE(array)
Lists each value once. Here the unique regions are counted.
=COUNTA(UNIQUE(Data!A2:A13))Result with the sample data: 3
Watch out: Extra spaces make two entries look different. Clean the data first.
Excel 2021 or Microsoft 365
No formula matches. Try a shorter word, such as "sum" or "date".
Read Excel formulas for sales operations, try the business calculator lab, or see the ready-made Excel templates.
Many of them use the same names there, but they have only been checked in Microsoft Excel. Test any formula in Google Sheets before relying on it.
Your version does not have that function, or the name is misspelled. Each card shows which versions include it. XLOOKUP, FILTER and UNIQUE need Excel 2021 or Microsoft 365.
Some regional settings use a semicolon to separate arguments. Replace the commas with semicolons if Excel rejects a formula.
The example workbook was opened and recalculated in Microsoft Excel, and each result was compared with an answer worked out separately. That check covers the sample data only.
Yes, you can use and change it for your own work. The data in it is made up. Check your own results before sharing reports.
Function names are Microsoft's. For full reference pages, see Microsoft Support. This library is general information; check results before using them for decisions.
We can automate the repeat work in your workbook, with a written scope and price before anything starts.