How to Calculate the Sum of Selected Cells in Excel|Including Non-Adjacent and Filtered Data

When analyzing data in Excel, one of the most common tasks is finding the sum of selected cells — for instance, totaling sales figures, expenses, or stock counts.
But what if the cells you want to add aren’t next to each other, or you’ve filtered the data to show only certain rows?

Excel offers several ways to calculate sums, depending on whether you’re working with continuous ranges, non-adjacent cells, or filtered data.

In this article, you’ll learn all the methods and functions for summing selected cells — from the simplest techniques to advanced formulas that handle complex scenarios.


✅ Basic Method: Using the SUM Function for Continuous Cells

・How the SUM Function Works

The SUM function is Excel’s most commonly used formula for addition. It adds up all numbers in a specified range.

Syntax:
=SUM(number1, [number2], ...)

・Example

AB
Sales
100
150
200

Formula:
=SUM(A2:A4)

→ Result: 450

This formula adds all the values from A2 to A4.
It’s the simplest and fastest way to get the total for a continuous column or row.

Tip: You can also use the AutoSum button on the toolbar — select a cell below your numbers, click Σ (AutoSum), and Excel automatically inserts =SUM() for you.


✅ Summing Non-Adjacent (Discontinuous) Cells

Sometimes, the cells you want to add are scattered across your worksheet. You can still use the SUM function by separating cell references with commas.

・Example

AB
100
150
200

Formula:
=SUM(A1, B2, A3)

→ Result: 450

Excel allows you to list each cell individually.
This is helpful when you want to total specific data points that are not in a continuous block.

Shortcut:
Hold Ctrl (Windows) or Command (Mac) while selecting multiple non-adjacent cells.
Then look at the Status Bar at the bottom-right of Excel — you’ll instantly see the sum without typing a formula.


✅ Summing Filtered Data Only (Visible Cells)

When you use filters, Excel’s normal SUM function still includes hidden rows, which can produce misleading totals.
To sum only visible cells, use the SUBTOTAL or AGGREGATE function.


・Method 1: Using SUBTOTAL

Syntax:
=SUBTOTAL(function_num, range)

For summing visible cells, use function_num = 9.

Example:
=SUBTOTAL(9, B2:B10)

This formula adds only the cells that remain visible after filtering.

Tip:
If you hide rows manually (not with a filter), SUBTOTAL still works correctly — it ignores hidden rows automatically.


・Method 2: Using AGGREGATE

AGGREGATE is a more flexible version of SUBTOTAL that allows multiple operations and the ability to ignore certain data types.

Syntax:
=AGGREGATE(function_num, options, array)

For visible cells only:
=AGGREGATE(9, 5, B2:B10)

  • 9 = SUM
  • 5 = Ignore hidden rows

When to Use:
If your dataset includes hidden rows, filtered data, or errors (like #DIV/0!), AGGREGATE gives you more control than SUBTOTAL.


✅ Summing Selected Cells from Multiple Sheets

If you’re working with monthly or departmental data stored across several sheets, Excel allows you to sum them all together in one formula.

・Example

To total sales in cell B2 across three sheets (January, February, March):

=SUM(January:March!B2)

Excel automatically includes all sheets between “January” and “March.”

Tip:
This technique works best when each sheet has the same layout (e.g., sales totals always in the same cell).


✅ Quick Summation Without a Formula

You don’t always need a formula to see totals. Excel’s Status Bar displays live calculations whenever you select cells.

・Steps

  1. Highlight any range of numbers.
  2. Look at the bottom-right corner of Excel.
  3. The sum automatically appears (along with average and count).

Use Case:
When you just need a quick check without inserting formulas into your sheet.

You can even right-click the Status Bar to customize what’s displayed (Sum, Average, Count, etc.).


✅ Using AutoSum for Instant Calculations

AutoSum (Σ) is a one-click shortcut that inserts a SUM formula automatically.

・Steps

  1. Select a cell directly below or to the right of your numbers.
  2. Click AutoSum (Σ) on the Home tab.
  3. Press Enter to confirm.

Excel automatically detects the range to sum — even if it’s vertical or horizontal.

Tip:
Press Alt + = (Windows) or Command + Shift + T (Mac) as a keyboard shortcut for AutoSum.


✅ Summing by Selection Criteria (Conditional Sums)

When you want to sum only cells that meet specific conditions (e.g., “Region = East” or “Status = Complete”), use SUMIF or SUMIFS.

・SUMIF Example

AB
RegionSales
East200
West150
East100

Formula:
=SUMIF(A2:A4,"East",B2:B4)

→ Result: 300

・SUMIFS Example (Multiple Conditions)

=SUMIFS(B2:B10, A2:A10, "East", C2:C10, ">100")

→ Adds up sales in the East region where the amount is greater than 100.

Tip:
Combine SUMIFS with filters for dynamic reporting dashboards.


✅ Summing Specific Cells Dynamically Using Named Ranges

To make your formulas easier to manage, assign names to important ranges.

・Steps

  1. Select your range (e.g., B2:B10).
  2. Go to Formulas → Define Name → enter “SalesData.”
  3. Use in your formula:
    =SUM(SalesData)

Benefit:
If you change the range later, Excel updates all linked formulas automatically.


✅ Summing Every Nth Cell or Patterned Data

If you only need to add values following a pattern — like every 3rd row — use the SUMPRODUCT function with a clever array formula.

・Example

=SUMPRODUCT((MOD(ROW(B2:B20)-ROW(B2),3)=0)*B2:B20)

This adds every third value in the range.
Perfect for periodic sampling or quarterly data summaries.

Advanced Tip:
You can modify the “3” to any number (e.g., every 5th cell).


✅ Summing Only Highlighted or Selected Cells (Manual Selection)

Unfortunately, Excel doesn’t have a built-in function to sum only highlighted cells (e.g., those with background color).
However, you can use a filter with color or a VBA macro to achieve it.

・Method 1: Filter by Color

  1. Click the filter dropdown on your column.
  2. Choose Filter by Color.
  3. Apply SUBTOTAL(9, range) — it will sum only the visible (colored) cells.

・Method 2: Use a Simple VBA Script (Optional)

If you frequently need this, you can use VBA:

Function SumByColor(CellRange As Range, ColorCell As Range) As Double
Dim c As Range
For Each c In CellRange
If c.Interior.Color = ColorCell.Interior.Color Then
SumByColor = SumByColor + c.Value
End If
Next c
End Function

Then, use it like this in your sheet:
=SumByColor(B2:B20, C1)

Caution: VBA macros require enabling “Developer Mode” and saving as .xlsm.


✅ Tips for Accurate Summation in Excel

・1. Check for Text Values

If numbers are stored as text (e.g., '100), Excel ignores them in SUM.
Convert text to numbers using =VALUE(A1) or the Data → Text to Columns trick.


・2. Beware of Hidden Rows

Regular SUM includes hidden data — use SUBTOTAL or AGGREGATE if you only want visible cells.


・3. Verify Calculation Mode

If totals don’t update automatically, go to:
Formulas → Calculation Options → Automatic

Otherwise, press F9 to refresh all formulas.


・4. Use Parentheses for Clarity

When combining SUM with other operations (like subtraction), use parentheses:
=A1 - SUM(B1:D1)

This ensures Excel calculates in the correct order.


✅ Summary: Mastering Sum Calculations in Excel

  • Use SUM(range) for continuous cells.
  • Use SUM(cell1, cell2, …) for non-adjacent cells.
  • Use SUBTOTAL(9, range) or AGGREGATE(9,5,range) for filtered/visible data only.
  • Check totals instantly using the Status Bar or AutoSum (Σ).
  • Use SUMIF / SUMIFS for conditional addition.
  • Define named ranges for dynamic calculations.
  • For advanced cases, use SUMPRODUCT or custom VBA functions.

By mastering these techniques, you can handle any summation scenario — from quick checks to detailed financial reports — efficiently and accurately.

Excel’s flexibility allows you to calculate totals for selected, scattered, or filtered cells without breaking your workflow.
Once you understand how each method works, you’ll never waste time manually adding numbers again.

上部へスクロール