Excel for Data Analysis series — Part 2. New to Excel? Start with Part 1: A Beginner’s Guide. This part covers the functions and PivotTables analysts use every day, and Part 3 turns the results into charts, reports, and dashboards.

The Excel functions analysts use most are SUMIFS and COUNTIFS (totals and counts that meet conditions), IF (decisions), and XLOOKUP or VLOOKUP (pulling data from another table). PivotTables then summarize thousands of rows into a clear table in seconds, without writing formulas.

In Part 1, you turned a sales dataset into an Excel table and found that the business made 30,420 in revenue from 30 orders. That’s the overall picture. Now you’ll answer the questions that matter: Which region sells the most? Which product categories drive revenue? How did sales change month by month?

Set Up the Practice Files

You’ll need two files:

  • sales-data.csv: 30 orders with Order ID, Date, Region, Salesperson, Product, Units, and Unit Price.
  • products.csv: a small lookup table listing each Product, its Category, and its Unit Price.

If you followed Part 1, you already have the sales data as a table named Sales with a Revenue column (=[@Units]*[@[Unit Price]]). If not, do that first: it takes two minutes.

Then copy the contents of products.csv into a new sheet named Products, convert it to a table with Ctrl + T, and name it Products in Table Design > Table Name.

Version note: XLOOKUP, UNIQUE, SORT, and FILTER require Microsoft 365, Excel 2021, Excel 2024, or Excel for the web. Everything else in this guide also works in Excel 2016 and 2019.

Cell References: Relative vs. Absolute

Before writing conditional formulas, one concept matters a lot. When you copy a formula, Excel adjusts its cell references:

ReferenceExampleWhen copied down
RelativeA2Becomes A3, A4, …
Absolute$A$2Always stays $A$2
Mixed$A2 or A$2Locks only the column or the row

Press F4 while editing a reference to cycle through these options. Table references like Sales[Revenue] don’t shift when copied down, which is one more reason to use tables.

SUMIFS: Add Up Values That Meet Conditions

SUMIFS adds the numbers in one column, but only for rows that match your criteria:

=SUMIFS(sum_range, criteria_range1, criteria1, [criteria_range2, criteria2], ...)

Revenue for the West region:

=SUMIFS(Sales[Revenue], Sales[Region], "West")

Result: 5,850, the same number you found with a filter in Part 1, but now as a formula that updates automatically.

Two conditions: West region and Office Chairs:

=SUMIFS(Sales[Revenue], Sales[Region], "West", Sales[Product], "Office Chair")

Result: 3,240.

A date range: North region in February 2026:

=SUMIFS(Sales[Revenue], Sales[Region], "North", Sales[Date], ">="&DATE(2026,2,1), Sales[Date], "<"&DATE(2026,3,1))

Result: 435. Comparison operators go in quotes and join to a value with &. Using “less than March 1” includes all of February, whatever its length.

Build a Summary Table

Instead of typing “West” into the formula, point to a cell. On a new sheet, list the regions in A2:A5 and put this in B2, then fill it down:

=SUMIFS(Sales[Revenue], Sales[Region], A2)
RegionRevenue
North11,110
South8,755
West5,850
East4,705

Now you can see that North leads with 36.5% of revenue, and East trails at 15.5%.

COUNTIFS: Count Rows That Meet Conditions

COUNTIFS works the same way but counts rows instead of adding values:

QuestionFormulaResult
How many laptop orders?=COUNTIFS(Sales[Product], "Laptop")5
How many laptop orders in the South?=COUNTIFS(Sales[Region], "South", Sales[Product], "Laptop")2
How many orders of 2,000 or more?=COUNTIFS(Sales[Revenue], ">=2000")5

AVERAGEIFS: Average Values That Meet Conditions

=AVERAGEIFS(Sales[Revenue], Sales[Region], "East")

Result: 784.17. East has the lowest average order value, which partly explains its lower total: it has fewer orders (6) and smaller ones.

The single-condition versions SUMIF, COUNTIF, and AVERAGEIF also exist, but the -IFS versions handle one condition or many, so it’s simpler to use them everywhere. Note that SUMIF puts the sum range last, while SUMIFS puts it first.

IF: Make Decisions in a Formula

IF returns one value when a condition is true and another when it’s false:

=IF(logical_test, value_if_true, value_if_false)

Add a column to the Sales table named Size that labels large orders:

=IF([@Revenue]>=2000, "Large", "Standard")

More Than Two Outcomes

For several tiers, use IFS (Excel 2019 and later), which checks conditions in order and returns the first match:

=IFS([@Revenue]>=2000, "Large", [@Revenue]>=500, "Medium", TRUE, "Small")

The final TRUE acts as “everything else.” With this data, you get 5 Large, 10 Medium, and 15 Small orders. (You can confirm with =COUNTIFS(Sales[Size], "Small").) In older Excel, nest IFs instead: =IF([@Revenue]>=2000, "Large", IF([@Revenue]>=500, "Medium", "Small")).

Combine conditions with AND and OR, for example =IF(AND([@Region]="North", [@Revenue]>=2000), "Key account", "").

XLOOKUP: Pull Data from Another Table

The Sales table doesn’t have a product category, but the Products table does. XLOOKUP finds a value in one column and returns the matching value from another.

=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found])

Add a Category column to the Sales table:

=XLOOKUP([@Product], Products[Product], Products[Category], "Not found")

For order 1001 (Keyboard), it returns Accessories; for 1002 (Laptop), Electronics. If a product isn’t in the Products table, you’ll see “Not found” instead of an error, which makes data problems easy to spot.

Why analysts prefer XLOOKUP:

  • It looks left or right; the return column can be anywhere.
  • It defaults to an exact match, so you can’t accidentally get a wrong approximate result.
  • It doesn’t break when someone inserts a column.
  • It has a built-in if-not-found value.

VLOOKUP: The Classic Lookup

You’ll still see VLOOKUP in many existing workbooks, and it’s the option in Excel 2019 and earlier:

=VLOOKUP([@Product], Products, 2, FALSE)

This looks for the product in the first column of the Products table and returns the value from the 2nd column (Category). Two rules matter:

  • Always use FALSE as the last argument for an exact match. With TRUE or nothing, VLOOKUP does an approximate match and can return the wrong row without warning.
  • VLOOKUP only looks right. The value you search for must be in the first column of the range.

Wrap any lookup in IFERROR to replace errors with something readable: =IFERROR(VLOOKUP([@Product], Products, 2, FALSE), "Not found").

Conditional Formatting: Make Patterns Visible

Conditional formatting changes a cell’s appearance based on its value, so important rows stand out at a glance. Select the Revenue column of the table, then go to Home > Conditional Formatting:

  • Highlight Cells Rules > Greater Than: enter 1999 to highlight the five orders of 2,000 or more.
  • Data Bars: draws a bar in each cell proportional to its value, like a mini chart.
  • Color Scales: shades cells from low to high (for example, red to green).
  • Top/Bottom Rules > Top 10 Items: set it to 5 to highlight the top five orders.
  • Highlight Cells Rules > Duplicate Values: apply it to Order ID to catch duplicate entries.

Highlight Entire Rows with a Formula

To highlight every West order across the whole row, select the table’s data rows (for example, A2:J31), choose New Rule > Use a formula to determine which cells to format, and enter:

=$C2="West"

The $ locks the Region column (C) while the row number changes, so every cell in a row checks that row’s region. Use Manage Rules to edit or delete rules later; too many rules make a sheet hard to read.

PivotTables: Summarize Data in Seconds

A PivotTable groups and summarizes data by dragging fields into place, with no formulas. It’s the fastest way to explore a dataset.

Create a PivotTable

  1. Click any cell in the Sales table.
  2. Go to Insert > PivotTable, keep New Worksheet, and click OK.
  3. In the PivotTable Fields pane, drag:
    • Region to Rows
    • Revenue to Values

Excel shows Sum of Revenue by region, with a Grand Total of 30,420. To sort, right-click a value and choose Sort > Sort Largest to Smallest.

The Four Areas

AreaWhat it doesExample
RowsGroups down the sideRegion
ColumnsGroups across the topCategory
ValuesWhat to calculateSum of Revenue
FiltersFilters the whole PivotTableSalesperson

Compare Regions and Categories

Drag Category (the column you added with XLOOKUP) into Columns:

RegionAccessoriesElectronicsFurnitureTotal
East3251,0003,3804,705
North6608,1502,30011,110
South8555,6002,3008,755
West7509004,2005,850
Total2,59015,65012,18030,420

Now the story is clearer: North’s lead comes from electronics (laptops and monitors), while West and East sell mostly furniture. That’s the kind of insight a single total can’t show.

Change the Calculation

Click the arrow on Sum of Revenue in the Values area and choose Value Field Settings:

  • Summarize Values By: switch to Count (number of orders), Average, Max, or Min.
  • Show Values As > % of Grand Total: shows each region’s share (North 36.5%, South 28.8%, West 19.2%, East 15.5%).
  • Number Format: apply currency formatting once for the whole PivotTable.

You can add the same field to Values twice, for example Sum of Revenue and Count of Order ID side by side.

Group Dates by Month

Remove Category from Columns, and drag Date into Rows instead of Region. In current versions of Excel, dates are grouped automatically; if not, right-click a date and choose Group > Months. The monthly totals are:

MonthRevenueShare
January16,32553.7%
February4,99516.4%
March9,10029.9%

February revenue dropped about 69% from January, then recovered in March. That’s worth investigating, and it’s exactly the kind of trend you’ll chart in Part 3.

Keep PivotTables Up to Date

PivotTables don’t recalculate automatically when the source data changes. After editing or adding data, right-click the PivotTable and choose Refresh, or use Data > Refresh All. Because the source is an Excel Table, new rows are included when you refresh.

Double-click any number in a PivotTable to see the rows behind it on a new sheet, a quick way to check your results.

Bonus: Dynamic Array Functions

In Microsoft 365, Excel 2021, and later, some functions return a whole list that “spills” into the cells below:

FormulaWhat it returns
=UNIQUE(Sales[Region])Each region once: South, North, West, East
=SORT(UNIQUE(Sales[Product]))The six products in alphabetical order
=FILTER(Sales, Sales[Revenue]>=2000)The five large orders, with every column

These are great for building summary tables that update automatically. If you see a #SPILL! error, the cells below the formula aren’t empty.

Quick Reference

TaskFunction
Sum with conditionsSUMIFS
Count with conditionsCOUNTIFS
Average with conditionsAVERAGEIFS
Choose between outcomesIF, IFS
Look up a valueXLOOKUP (or VLOOKUP with FALSE)
Replace errorsIFERROR
List unique valuesUNIQUE
Filter rows with a formulaFILTER
Summarize without formulasPivotTable

Common Errors and Fixes

ErrorUsual causeFix
#N/AA lookup can’t find the valueCheck spelling and extra spaces (TRIM), or add an if-not-found value
#VALUE!Text where a number is expectedConvert text to numbers; check for stray characters
#REF!A referenced cell was deletedUndo, or rewrite the formula with the correct range
#NAME?A misspelled function, or a function your Excel version doesn’t haveCheck the spelling and your Excel version
#SPILL!A dynamic array can’t spillClear the cells below the formula
SUMIFS returns 0Criteria don’t match exactly, or numbers are stored as textCompare the criteria with the data; convert text to numbers
PivotTable shows old numbersIt wasn’t refreshedRight-click > Refresh

Frequently Asked Questions

What’s the difference between SUMIF and SUMIFS?

SUMIF handles one condition; SUMIFS handles one or more. The arguments are also in a different order: SUMIFS starts with the range to add. Using SUMIFS for everything keeps your formulas consistent.

Should I use XLOOKUP or VLOOKUP?

Use XLOOKUP if everyone who opens the file has Microsoft 365, Excel 2021, or later. It’s more flexible and less error-prone. Use VLOOKUP (always with FALSE) when the workbook must work in older versions.

What is a PivotTable used for?

Summarizing large datasets quickly: totals, counts, and averages grouped by categories or dates, without writing formulas. Analysts use them to explore data and find patterns before building charts and reports.

Why isn’t my PivotTable updating?

PivotTables only update when you refresh them. Right-click inside it and choose Refresh, or use Data > Refresh All. If new rows still don’t appear, check that the source is an Excel Table or that the source range includes them.

Can I use wildcards in SUMIFS and COUNTIFS?

Yes. * matches any characters and ? matches one character. For example, =COUNTIFS(Sales[Product], "*Chair*") counts any product containing “Chair.”

How is this different from DAX in Power BI?

The ideas are similar: conditional totals and grouping. DAX is Power BI’s formula language and works on whole data models. If you know SUMIFS and PivotTables, DAX functions will feel familiar.

Conclusion

With a handful of functions, you can answer most business questions in Excel: SUMIFS, COUNTIFS, and AVERAGEIFS for conditional totals; IF for labels and decisions; XLOOKUP or VLOOKUP to bring data together; conditional formatting to make patterns visible; and PivotTables to summarize everything in seconds.

In the sample data, these tools showed that North leads because of electronics sales, that West and East rely on furniture, and that February was a weak month. The next step is to present those findings so other people understand them at a glance.

Next in the Excel for Data Analysis series: Excel Data Analysis: How to Create Charts, Reports, and Dashboards.

Excel for Data Analysis series: Part 1: A Beginner’s Guide · Part 2: Essential Functions and Pivot Tables · Part 3: Charts, Reports, and Dashboards