KutoolsforOffice — One Suite. Five Tools. Get More Done.February Sale: 20% Off

How to calculate cumulative sum / running total of a column in Excel? 

AuthorXiaoyangLast modified

In data analysis, monitoring how values accumulate over time or across entries can be crucial. A cumulative sum, also known as a running total, lets you continuously track the aggregate of numbers in a sequence, automatically updating as new entries are added. This is particularly useful for financial ledgers, inventory management, sales tracking, or any task where progressive totals are important. In this article, you will find detailed step-by-step solutions to compute running totals in your Excel worksheet, along with practical tips, notes, and troubleshooting advice tailored to common real-world scenarios.

Calculate cumulative sum or running total of a column with formulas

VBA Code - Automate cumulative sum calculation for dynamic datasets or large ranges


Calculate cumulative sum or running total of a column with formulas

To get the cumulative sum for column data in Excel, you can use straightforward formulas that dynamically calculate a running total as values are entered. 

1. Enter this formula: =SUM($B$2:B2) into a blank cell beside your data (for example, if your numbers are in column B starting from row 2, enter this formula in cell C2), as shown in the screenshot:

enter a formula to calculate cumulative sum

2. Press Enter to confirm the formula. The cell will now display the cumulative sum up to that row. To apply this calculation to more rows, select the cell containing the formula, then drag the fill handle (a small square at the lower right corner of the active cell) down to fill additional cells as needed. See screenshot:

drag and fill the formula to other cells

Note: By default, the above formula will continue to display the last computed total in rows where column B is blank; this can sometimes cause confusion when reviewing results below your input data. For cleaner results, especially in reports or dashboards, use the improved formula below to leave cells empty where there are no adjacent values:

=IF(B2="","",SUM($B$2:B2))

This way, only rows with actual input values in column B show a running total. See the improved output in the screenshot below:

a formula don’t show anything if adjacent cell is blank

When extending these formulas, make sure your reference range ($B$2:B2) stays consistent—if you are starting your calculations in a different row, adjust the references accordingly. If your dataset is large, consider using Excel Tables, which automatically adjust ranges as data grows.

a screenshot of kutools for excel ai

Unlock Excel Magic with Kutools AI

  • Smart Execution: Perform cell operations, analyze data, and create charts—all driven by simple commands.
  • Custom Formulas: Generate tailored formulas to streamline your workflows.
  • VBA Coding: Write and implement VBA code effortlessly.
  • Formula Interpretation: Understand complex formulas with ease.
  • Text Translation: Break language barriers within your spreadsheets.
Enhance your Excel capabilities with AI-powered tools. Download Now and experience efficiency like never before!

VBA Code - Automate cumulative sum calculation for dynamic datasets or large ranges

For users dealing with very large ranges, constantly expanding datasets, or requiring automation across multiple sheets, a VBA macro offers an efficient alternative for calculating cumulative sums. Using VBA, you can avoid constantly dragging formulas, automate recalculation after updates, and adapt to changing data structures. This approach is recommended for intermediate users familiar with basic macro usage.

1. First, open the VBA editor: Click Developer Tools > Visual Basic. In the new Microsoft Visual Basic for Applications window, click Insert > Module, and then paste the code below into the module window:

Sub CalculateCumulativeSum()
    Dim selRange As Range
    Dim outputCol As Integer
    Dim i As Long
    Dim cumSum As Double
    
    On Error Resume Next
    xTitleId = "KutoolsforExcel"
    
    Set selRange = Application.Selection
    Set selRange = Application.InputBox("Select the range for running total calculation (single column):", xTitleId, selRange.Address, Type:=8)
    
    If selRange Is Nothing Then Exit Sub
    
    outputCol = selRange.Columns(selRange.Columns.Count).Column + 1
    cumSum = 0
    
    For i = 1 To selRange.Rows.Count
        If IsNumeric(selRange.Cells(i, 1).Value) And selRange.Cells(i, 1).Value <> "" Then
            cumSum = cumSum + selRange.Cells(i, 1).Value
            selRange.Cells(i, 1).Offset(0, 1).Value = cumSum
        Else
            selRange.Cells(i, 1).Offset(0, 1).Value = ""
        End If
    Next i
End Sub

2 To run the macro, click the Run button button or press F5. When prompted, select the data range (one column only) you want to process. The macro will fill running totals in the column immediately to the right.

This method is particularly effective on large or dynamically changing datasets, allowing you to re-run the macro whenever the data is updated. However, always back up your data before running any macro, as it directly overwrites cell values. For performance, avoid running this macro on entire columns or non-contiguous ranges.

If the macro does not calculate expected values, ensure that only numeric data is included in the selected range and that there are no merged cells.

Best Office Productivity Tools

🤖Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |  Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |  Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more
Use Kutools in your preferred language – supports English, Spanish, German, French, Chinese, and 40+ others!

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...


Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!

All Kutools add-ins. One installer

Kutools for Office suite bundles add-ins for Excel, Word, Outlook & PowerPoint plus Office Tab Pro, which is ideal for teams working across Office apps.

ExcelWordOutlookTabsPowerPoint
  • All-in-one suite — Excel, Word, Outlook & PowerPoint add-ins + Office Tab Pro
  • One installer, one license — set up in minutes (MSI-ready)
  • Works better together — streamlined productivity across Office apps
  • 30-day full-featured trial — no registration, no credit card
  • Best value — save vs buying individual add-in