Americas

  • United States

Asia

shimon brathwaite
Freelance writer

How to use Excel formulas and functions

how-to
May 10, 202320 mins
MicrosoftMicrosoft 365Microsoft Excel

Formulas are powerful tools for performing calculations and analyzing data in Excel. In this beginner’s guide, you’ll learn how to use formulas and explore some popular built-in functions.

teach train direct learn formula stategy charts
Credit: Thinkstock

One of the most commonly used Microsoft programs, Excel is highly useful for data collecting, processing, and analysis. To fully harness Excel’s powers, though, you need to make use of formulas.

Excel formulas allow you to perform calculations, analyze data, and return results quickly and accurately. The usefulness of formulas is even greater once you start dealing with large data sets. With the correct formula, Excel can process vast amounts of information in a matter of seconds.

What is a formula in Excel?

A formula is an expression that operates on values in a range of cells in Excel. Using formulas, you can perform calculations and data analysis on the contents of the cells. Formulas can be as simple as adding a column of numbers together or as complex as returning the kurtosis of a data set. They can be incredibly useful when you want to turn spreadsheet data into meaningful information for driving business decisions.

What is a function in Excel?

A function is a built-in formula in Excel — basically, a shortcut for performing a calculation or other operation on cell data. There are nearly 500 Excel functions, and the list continues to grow every year. Fortunately, most of the actions that a typical business user would want to perform can be done with just a handful of functions.

In this article we’ll look at five useful types of formulas and functions that will get you started performing data analysis in Excel. Along the way, you’ll learn several different ways to enter formulas and functions in Excel.

We’ll demonstrate using Excel for Windows under a Microsoft 365 subscription. If you’re using a different version of Excel, you might not have exactly the same interface and options, but the formulas and functions work the same.

1. Basic mathematics formulas and functions

We’re going to group these formulas together since they are very simple and have similar syntax. All formulas in Excel start with the equal sign (=) and build from there.

Adding, subtracting, multiplying, and dividing

To add the numbers in two cells together, first click the on the target cell where you want the total to appear. Then type = in the cell to start the formula.

excel formulas 01 start formula

Starting a formula in Excel.

Shimon Brathwaite / IDG

Next, click on the cell that contains the first number you want to add, and its cell reference (such as A2) will appear next to the equal sign in the formula.

excel formulas 02 formula cell selected

When you select a cell when building a formula, its cell reference appears in the formula.

Shimon Brathwaite / IDG

Type + next to the first cell reference. Then click the cell that contains the second number you want to add, and its cell reference (such as A3) will appear next to the + sign. The full syntax for the formula to add the values in cells A2 and A3 is:

=A2+A3

excel formulas 03 adding two cells

The complete addition formula appears in both the target cell and the formula bar above.

Shimon Brathwaite / IDG

Note that in addition to appearing in the target cell, the formula also appears in the formula bar directly above the worksheet. Once you’ve inserted the initial = sign in the target cell, you can type your formula in the formula bar. It’s sometimes easier to see the whole formula and work with it in the formula bar than down in the worksheet page.

If you wanted to add additional numbers to your total, you’d type another + sign, select another cell, and so on. Once your formula is complete, press Enter, and the result appears in the target cell.

excel formulas 04 addition result

Press Enter, and the result appears in the target cell.

Shimon Brathwaite / IDG

Subtraction, multiplication, and division calculations work the same way. You simply change the operator — the symbol that tells Excel what math operation you want to perform — from the + sign to the sign for subtraction, the * sign for multiplication, or the / sign for division.

excel formulas 05 subtract multiply divide

Subtraction, multiplication, and division actions. The formula for each is shown in the formulas bar; the result in the target cell.

Shimon Brathwaite / IDG

Adding numbers with the SUM function

There’s a quicker way to add together a group of numbers. This is where Excel’s built-in SUM function comes in.

First click on the target cell where you want the total to appear. Then type =SUM to start the function.  A list of options will come up. Click the first option, SUM. You’ll now see =SUM( in the target cell.

excel formulas 06 start sum function

Starting a SUM function.

Shimon Brathwaite / IDG

Just underneath the cell with the SUM function is a tooltip showing the SUM syntax:

=SUM(number 1, [number2],…)

To add individual cells together, select a cell, type a comma, select another cell, and so on. (Alternatively, you can type a cell reference, type a comma, type another cell reference, and so on.)

If you want to add consecutive cells (such as in a row or column), select the first cell, then hold down the Shift key and select the final cell in the group. (Or you can type in the cell references for the first and last cells separated by a colon — for instance, A2:A7 selects A2, A7, and all the cells in between.)

excel formulas 07 sum function cell range selected

Select the range of cells you want to add together.

Shimon Brathwaite / IDG

Once all the cells you want to add together are selected, hit Enter.

Now you should see the final result, which is the sum of the numbers you highlighted. If you highlight that target cell again, you’ll see the full formula in the formula bar — in our example, it’s:

=SUM(A2:A7)

excel formulas 08 sum function result

The SUM function is shown in the formulas bar; the result appears in the target cell.

Shimon Brathwaite / IDG

One important thing to note for all Excel formulas is that they produce relative values. This simply means that if any of the values in the selected cells changes, then the final number will change to reflect that.

excel formulas 09 relative values

If the value of a cell used in a formula changes, the result also changes.

Shimon Brathwaite / IDG

If you want to make it an absolute value, a number that will not change even if the cells that were used to calculate it change, then you need to right-click the cell and select Copy from the pop-up menu. Then right-click the cell again and, under Paste Options, select the Values button (the icon of a clipboard with 123).

excel formulas 10 paste values

Copy and paste the value into the cell to prevent the value from changing if one of the source cell’s values changes.

Shimon Brathwaite / IDG

Now when you select that cell you’ll just see the plain number, not a formula, in the formula bar.

excel formulas 11 absolute value not formula

The cell now contains an absolute value, not a formula.

Shimon Brathwaite / IDG

Tip: Excel provides a SUM shortcut in certain circumstances. If you have a series of numbers in a row or a column, Excel assumes you want to add them together. So if you place your cursor in the cell to the right of a row of numbers and click the AutoSum (Σ) button toward the right end of the Ribbon’s Home tab, Excel automatically selects the numbers in the row, then adds them together when you press Enter. Likewise, if you place your cursor in the cell below a column of numbers, click AutoSum, and hit Enter, Excel totals up the numbers in the column.

excel formulas 12 autosum

AutoSum is a shortcut for adding a row or column of numbers.

Shimon Brathwaite / IDG

Calculating the average with the AVERAGE function

To calculate the average of a group of numbers, repeat the same steps but using the syntax =AVERAGE and highlighting the cells containing the numbers that you want to use in the calculation.

excel formulas 13 average function

To quickly calculate the average of a group of numbers, use the AVERAGE function.

Shimon Brathwaite / IDG

Tip: As with SUM, there’s a shortcut for using the AVERAGE function if you have a series of numbers in a row or a column. Place your cursor in the cell to the right of a row of numbers or in the cell below a column of numbers. Click the tiny down arrow at the right side of the AutoSum button, select Average from the menu that appears, and hit Enter. Excel calculates the average of the values in that row or column.

excel formulas 14 autosum average

There’s an AutoSum shortcut for the AVERAGE function as well.

Shimon Brathwaite / IDG

Find more details, examples, and best practices for these functions at Microsoft’s SUM function and AVERAGE function support pages.

2. The IF function

This function helps you automate the decision-making process by applying if-then logic to your data. Using this function, you can have Excel perform a calculation or display a certain value depending on the outcome of a logical test. For example, you can create a test that checks if the value of a cell is greater than or equal to the value of 18 and enter “Yes” or “No” accordingly.

While we’re learning this function, we’ll cover another way to enter functions in Excel: by using the Formulas tab on the Ribbon. Here you’ll find buttons that provide quick access to functions by category: AutoSum, Financial, Logical, Text, Date & Time, and so on. Being able to browse through functions by category can be helpful if you can’t remember the exact name of a function or aren’t sure how to spell it.

To enter the IF function, select the target cell, and on the Formulas tab, click the Logical button, then select IF from the list of functions that appears.

Alternatively, you can click the Insert Function button all the way to the left of the Formulas tab. An “Insert Function” pane appears, showing a list of commonly used functions.

excel formulas 15 formulas tab insert if function

Instead of typing = to start a function, you can go to the Formulas tab and select Insert Function.

Shimon Brathwaite / IDG

Select IF from the list and click OK. (If the function you want isn’t in the “Commonly Used” list, select a different category or All to see all available functions.)

The Function Arguments pane appears, and you’ll see =IF() in the target cell.

excel formulas 16 function arguments dialog box for if function

You can use the Function Arguments dialog box to build a function.

Shimon Brathwaite / IDG

The IF function syntax is as follows:

=IF(logical_test,”value_if_true”,”value_if_false”)

You’ll notice that the Function Arguments pane for the IF function has fields for Logical_test, Value_if_true, and Value_if_false. In our “greater than or equal to 18” example, the logical test is whether the number in the selected cell is greater than or equal to 18, the value if true is “Yes,” and the value if false is “No.” So we’d enter the following items in the pane’s fields like so:

Logical_test: B2>=18

Value_if_true: “Yes”

Value_if_false: “No”

or just type the full formula into the target cell:

=IF(B2>=18,”Yes”,”No”)

This tells Excel that if the value of cell B2 is greater than or equal to 18, it should enter “Yes” in the target cell. If the value of cell B2 is less than 18, it should enter “No.”

excel formulas 17 if function

The IF function in action.

Shimon Brathwaite / IDG

Tip: When using functions like this, rather than entering the function repeatedly for each row, you can simply click and drag the tiny square on the bottom right of the cell that contains the function. Doing so will autofill each of the rows with the formula, and Excel will change your cell references to match. For example, when the formula we used in cell C2 that references cell B2 is autofilled into cell C3, it changes to reference cell B3 automatically.

excel formulas 18 copy formula down

Autofilling a formula to subsequent rows in the column.

Shimon Brathwaite / IDG

Find more details at Microsoft’s IF function support page.

Next page: SUMIF, COUNTIF, CONCAT, and VLOOKUP →

3. The SUMIF and COUNTIF functions

SUMIF is a more advanced SUM function that allows you to add up only the values in a range that meet the criteria you specify. To use this function, you must specify the range of cells to apply the criteria to, the criteria for inclusion, and, optionally, the sum range, which is the range of cells to total if that’s different from the initial range. The syntax is as follows:

=SUMIF(range,criteria,[sum_range])

Note that any criteria with text or mathematical or logical symbols must be enclosed in double quotes.

In the sales spreadsheet shown below, for example, suppose you want to total up only the sales that are more than $100. The criteria range is C2 to C9, and the criteria is “greater than 100.” Since you’re adding up the values in that same cell range (C2 to C9), you don’t need to supply a separate sum range. So your formula is:

=SUMIF(C2:C9,”>100″)

excel formulas 19 sumif function example1

Using the SUMIF function.

Shimon Brathwaite / IDG

What if instead you want to find the total for all sales in the East region only? To do that you’ll have to specify both the criteria range (cells B2 to B9) and the sum range (cells C2 to C9). This is the formula:

=SUMIF(B2:B9,B2,C2:C9)

Note that you don’t have to type out “East” for the criteria. You can simply type B2 or click the cell B2 to have Excel search for the text it contains.

excel formulas 20 sumif function example2

Using SUMIF with both a criteria range and a sum range.

Shimon Brathwaite / IDG

There is a similar function called COUNTIF that lets you create a count of values that meet specified criteria. The syntax is as follows:

=COUNTIF(range,criteria)

So to count the total number of sales in the West region, for instance, you supply the range of cells to apply the criteria to (B2 to B9), followed by the criteria (“West” or cell B3). The formula is:

=COUNTIF(B2:B9,B3)

excel formulas 21 countif function

The COUNTIF function can instantly count up items that meet your criteria.

Shimon Brathwaite / IDG

What if you want to apply multiple criteria to your data, such as calculating total sales for books in the East region, or counting the number of sales over $100 in the West region? Excel can do that too, via functions called SUMIFS and COUNTIFS. These functions use more complex syntax than SUMIF and COUNTIF. For more details, use cases, and best practices for all four of these functions, see Microsoft’s SUMIF, SUMIFS, COUNTIF, and COUNTIFS support pages.

4. The CONCAT function

This function is useful for piecing together text from different cells into one complete string. For instance, maybe you have a worksheet with different columns for people’s first and last names, but you want to put first and last names together. Other common use cases are completing an address, reference number, file path, or URL. The syntax is as follows:

=CONCAT(text1,text2,text3,…)

In this example we will use CONCAT to combine a list of first names and last names into a full name with a space in between. To do so we simply place the cursor in cell C2, type =CON and select CONCAT from the list of options that appears. Next, select the cell that contains the first name (A2) and add a comma, a blank space surrounded by quotation marks, and another comma. Then add the last name by selecting the adjacent cell (B2) and hit Enter. Here’s the full formula:

=CONCAT(A2,” “,B2)

Next, click and drag the bottom right of cell C2 to autofill the formula in all the other rows.

excel formulas 22 concat function

The CONCAT function combined the values from column A with those from column B.

Shimon Brathwaite / IDG

For more details and examples, see Microsoft’s CONCAT function support page.

5. The VLOOKUP function

This is one of the most commonly used functions in Excel and a valuable data analysis tool. VLOOKUP lets you look up a value in a table and return information from other columns related to that value. It’s very useful for combining data from different lists or comparing two lists to find matching items. To use this function, you need to provide three to four pieces of information:

  1. The value you want to look for. This is known as the lookup value.
  2. The range of cells to look in. This is known as the table array.
  3. The column that contains the information you want to return, called the column index number.
  4. Optionally, the type of lookup you want to perform: TRUE or FALSE. This is known as the range lookup. FALSE means you want an exact match for the lookup value, while picking TRUE returns the best approximate match. If you don’t specify a range lookup, VLOOKUP defaults to TRUE.

The syntax is as follows:

=VLOOKUP(lookup_value,table_array,column_index_number,[range_lookup])

The lookup value must be in the first column of cells you specify in the table array. The leftmost column in the table array has a column index number of 1, with subsequent columns numbered 2, 3, and so on.

In this example, we’ll look up what region our employees work in. To do so, we first need to specify the value that we are going to search for: the employee name Mike (cell A2). Next, we need to highlight the entire cell range (table array) that we want to look in: cells F2:G8.

Then we specify which column holds the information that we want. Rather than picking the column itself, we count from left to right within the table array. Since the column that contains the region is the second from the left, type in 2.

Lastly, we enter the TRUE (best approximate match) or FALSE (exact match) option. TRUE is typically only used with numbers or when you aren’t sure if the value you want is in the table. Since we know the value we want is in the table, we will pick FALSE. Generally, FALSE is the better option, as it returns more accurate results.

This is the full formula:

=VLOOKUP(A2,F2:G8,2,FALSE)

excel formulas 23 vlookup function

Use VLOOKUP to find values linked to other values in large data sets.

Shimon Brathwaite / IDG

This is an oversimplified example using a small data set, but when you need to search through a spreadsheet with thousands (or tens of thousands) of cells, VLOOKUP is a huge time-saver and reduces the possibility of errors. For more details and examples, see Microsoft’s VLOOKUP function support page.

You’re just getting started

In this story you’ve seen how powerful formulas and functions can be in Excel — and we’ve only the scratched the surface of what they can do. Once you get comfortable using them, you can explore some of the myriad prebuilt functions Excel offers and learn how to build more complex formulas (including nesting functions). That’s all beyond the scope of this article, but a great place to start is Microsoft’s “Overview of formulas in Excel” support page, which includes links to several helpful tutorials.

More Excel tips and how-tos: