Have sum total at the bottom of a column regardless of the number of rows

natemoss1218

New Member
Joined
Aug 6, 2021
Messages
14
Office Version
  1. 365
Platform
  1. Windows
Hi all,

I am not sure if this is possible the way I want it, but figured it was at least worth picking the much smarter brains in this forum.

I want to put a sum total at the bottom of a column. But, the number of rows in that column will change daily. Lets say it's in column A. One day there may be 20 entries in column A in which case I would want the word "Total" in row 21 and the actual sum in row 22 of column A. The next day it may be 7 entries in which case I would want the word "Total" in row 8 and the actual sum in row 9. For this use case, pivot tables would not work due to formatting and a slew of other reasons. Additionally, this needs to be fully automated - meaning coming back to this daily and summing the rows isn't an option.

Again, I know this probably isn't doable, but figured I would ask!

Thanks in advance
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
hI
WHAT ABOUT
VBA Code:
Sub test()
    Dim LR As Long
    Dim x
    LR = Cells(Rows.Count, 1).End(xlUp).Row - 1
        x = Application.Transpose(Sheets("sheet1").Cells(2, 1).Resize(LR))
   Cells(LR + 1, 1) = "TOTAL"
    Cells(LR + 2, 1) = WorksheetFunction.Sum(x)
End Sub
 
Upvote 0
Another option
VBA Code:
Sub natemoss()
   With Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp)
      .Offset(1).Value = "Total"
      .Offset(2).FormulaR1C1 = "=sum(r1c:r[-2]c)"
   End With
End Sub
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,734
Messages
6,126,542
Members
449,316
Latest member
sravya

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top