Sum multiple columns
To sum all values in multiple columns you can apply an Excel or a VBA method using the Excel SUM function
Example: Sum multiple columns
Sub Sum_multiple_columns()
'declare a variable
Dim ws As Worksheet
Dim ws As Worksheet
Set ws = Worksheets("Analysis")
'apply the formula to sum all numbers in columns C and D
ws.Range("F5") = Application.WorksheetFunction.Sum(ws.Range("C:D"))
ws.Range("F5") = Application.WorksheetFunction.Sum(ws.Range("C:D"))
End Sub
OBJECTS
Worksheets: The Worksheets object represents all of the worksheets in a workbook, excluding chart sheets.
Range: The Range object is a representation of a single cell or a range of cells in a worksheet.
Worksheets: The Worksheets object represents all of the worksheets in a workbook, excluding chart sheets.
Range: The Range object is a representation of a single cell or a range of cells in a worksheet.
PREREQUISITES
Worksheet Name: Have a worksheet named Analysis.
Data Range: Ensure that the data that you want to sum from is captured in range ("C:D") in the Analysis worksheet.
Worksheet Name: Have a worksheet named Analysis.
Data Range: Ensure that the data that you want to sum from is captured in range ("C:D") in the Analysis worksheet.
ADJUSTABLE PARAMETERS
Date Range: Select the columns that you want to sum by changing range ("C:D") to any range in the worksheet, that doesn't conflict with the formula.
Output Range: Select the output range by changing the cell reference ("F5") to any cell in the worksheet, that doesn't conflict with the formula.
EXPLANATION
To sum all values in multiple columns you can apply an Excel or a VBA method. The formula used to sum values in multiple columns is driven by an Excel SUM function.
In both the VBA and Excel examples the formula sums all of the numbers in columns C and D. This is achieved through the use of the Excel SUM function.
To sum all values in multiple columns you can apply an Excel or a VBA method. The formula used to sum values in multiple columns is driven by an Excel SUM function.
In both the VBA and Excel examples the formula sums all of the numbers in columns C and D. This is achieved through the use of the Excel SUM function.
FORMULA
=SUM(column_references)
=SUM(column_references)
ARGUMENTS
column_references: The columns which you want to sum.
column_references: The columns which you want to sum.