Sum the last N columns in Excel
To sum values in the last n columns, normally you may need to calculate the sum of each column and then add up the results to get the final sum. This tutorial provides a formula based on the INDEX function to help you easily get it done.
How to sum values in the last n columns in Excel?
As shown in the example below, there is a monthly sales table, to sum only the sales in the last 3 months (Apr, May and Jun), you can follow the steps below.
Generic Formulas
=SUM(INDEX(data_range,0,COLUMNS(data_range)-(n-1)):INDEX(data_range,0,COLUMNS(data_range)))
Arguments
How to use this formula?
Select a formula, copy or enter the formula below and press the Enter key to get the result.
=SUM(INDEX(C5:H10,0,COLUMNS(C5:H10)-(B13-1)):INDEX(C5:H10,0,COLUMNS(C5:H10)))
Note: In this case, cell B13 contains the number representing the last N columns, you can directly type this number into the formula and enclose it in double quotation marks as follows.
=SUM(INDEX(C5:H10,0,COLUMNS(C5:H10)-("3"-1)):INDEX(C5:H10,0,COLUMNS(C5:H10)))
Explanation of the formula
=SUM(INDEX(C5:H10,0,COLUMNS(C5:H10)-(B13-1)):INDEX(C5:H10,0,COLUMNS(C5:H10)))
Related functions
Excel SUM function
The Excel SUM function adds values.
Excel INDEX function
The Excel INDEX function returns the displayed value based on a given position from a range or an array.
Excel COLUMNS function
The Excel COLUMNS function returns the total number of columns in a given array or reference.
Related formulas
Sum multiple columns if one criterion is met
This tutorial will guide you how to sum values in multiple columns based on the same criterion in Excel.
Sum top N values or top N values with criteria
This step-by-step tutorial demonstrates how to use the SUMPRODUCT function with the LARGE function to sum the top N values in a range and sum the top N values in a range with criteria in Excel.
Sum values based on column or both column and row
This tutorial provides different formulas based on the SUMPRODUCT function to help you sum values based on a column header, and sum values based on both column and row criteria.
Sum values in last N days based on criteria
To sum values in last N days based on specific criteria in Excel, you can apply a formula based on the SUMIF and TODAY function.
The Best Office Productivity Tools
Kutools for Excel - Helps You To Stand Out From Crowd
Kutools for Excel Boasts Over 300 Features, Ensuring That What You Need is Just A Click Away...
Supports Office/Excel 2007-2021 and 365 | Available in 44 Languages | Easy to Uninstall Completely

Office Tab - Enable Tabbed Reading and Editing in Microsoft Office (include Excel)
- One second to switch between dozens of open documents!
- Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
- Increases your productivity by 50% when viewing and editing multiple documents.
- Brings Efficient Tabs to Office (include Excel), Just Like Chrome, Edge and Firefox.
