How to copy sum of selected cells only in Excel?
For example you have a range of number cells in Excel, and now you need to copy this range’s sum and paste into another cell, how could you handle it quickly? This article will share some easy workarounds to copy the sum of selected cells only in Excel.
- Reuse Anything: Add the most used or complex formulas, charts and anything else to your favorites, and quickly reuse them in the future.
- More than 20 text features: Extract Number from Text String; Extract or Remove Part of Texts; Convert Numbers and Currencies to English Words.
- Merge Tools: Multiple Workbooks and Sheets into One; Merge Multiple Cells/Rows/Columns Without Losing Data; Merge Duplicate Rows and Sum.
- Split Tools: Split Data into Multiple Sheets Based on Value; One Workbook to Multiple Excel, PDF or CSV Files; One Column to Multiple Columns.
- Paste Skipping Hidden/Filtered Rows; Count And Sum by Background Color; Send Personalized Emails to Multiple Recipients in Bulk.
- Super Filter: Create advanced filter schemes and apply to any sheets; Sort by week, day, frequency and more; Filter by bold, formulas, comment...
- More than 300 powerful features; Works with Office 2007-2019 and 365; Supports all languages; Easy deploying in your enterprise or organization.
We can apply a VBA to copy the sum of selected cells only and then paste into another cell in Excel. Please do as follows:
1. Select the number cells whose sum you will copy only, and press the Alt + F11 keys to open Microsoft Visual Basic for Applications window.
2. Click Insert > Module, and then paste below VBA code into the opening Module window.
VBA: Copy sum of selected cells only in Excel
Sub CopySum() Dim xOb As New DataObject xOb.Clear xOb.SetText Application.WorksheetFunction.Sum(Application.ActiveWindow.RangeSelection) xOb.PutInClipboard MsgBox "The sum of selected cells has been copied to the Clipboard.", vbInformation, "Kutools for Excel" End Sub3. Click Tools > References to open the References – VBAProject window.
4. In the References - VBAProject dialog box, please click the Browse button. Next select the FM20.DLL file in the folder of C:\Windows\System32 in the popping up Add Reference dialog box, and then click the Open button and OK button successively to close two dialog boxes. See screenshot:
Note: If the Microsoft Forms 2.0 Object Library option exists in the Available References box of References – VBAProject window, please check this option directly, and then click the OK button.
5. Now you return to the Module window, please press the F5 key or the Run button to run this VBA code.
And now a dialog box comes out and tell you the sum of selected cells has been copied to the Clipboard already. Please click the OK button to close it.
6. Go ahead to select the destination cell you will paste the sum into, and press the Ctrl + V keys simultaneously to paste the sum of selected cells.
Some Excel users may be reluctant to use the VBA code. Do not worry! This method will help you to copy the sum of selected cells only with creating a name range and applying the SUM function.
1. Select the range of cells whose sum you will copy, type a name in the Name box at the upper-left corner, and press the Enter key.
In our case, we define the name range as copy_sum in the Name box. See screenshot:
2. Select the destination cell you will paste the sum of these cells, type the formula =SUM(copy_sum) into it, and press the Enter key.
And now the sum of all cells in the name range returns in the selected cell.
Sometimes, there may be hidden cells, rows, or columns in the selected range whose sum you will copy. And you need to copy the sum ignoring any hidden cells, rows, and columns. How? Try this method!
1. Select the range with hidden rows and columns whose sum you will copy, type a name in the Name box at the upper-left corner, and press the Enter key. See screenshot:
In our case, we define the name range as copy_sum_visible in the Name box. See screenshot:
2. Select the destination cell you will place the sum at, and type the formula =SUMVISIBLE(copy_sum_visible) into it, and press the Enter key.
(1) The SUMVISIBLE function is one of multiple useful built-in functions provided by Kutools for Excel.
(2) The sum value will become error if you send this workbook to others who don't install this Kutools for Excel. For the sake of avoiding this problem, we recommend you to replace the formula with its calculated value by Kutools for Excel's To Actual utility. Full Feature Free Trial 30-day!