It seem simple but I cannot find a way to define a range that goes up to the end of the column in an Excel formula.
For instance I can use this equation SUM(C:C) to sum all number found on the column C. However, given that the top of the page has titles and column headers, I would like to start my range at line 6. I thought SUM(C6:C) would do it but it does not work in Excel.
This is required so my SUM is always right no matter how many lines of data I add to my document in the future.
Thanks.
Save the code and close the window, then type this formula =SumColumn(A1) (A1 is the first cell in the list column) into the first cell of list column, press Enter button, then the list except the header is summed up.
If you need to sum a column or row of numbers, let Excel do the math for you. Select a cell next to the numbers you want to sum, click AutoSum on the Home tab, press Enter, and you're done.
(1) Select the column name that you will sum based on, and then click the Primary Key button; (2) Select the column name that you will sum, and then click the Calculate > Sum. (3) Click the Ok button.
Just organize your data in table (Ctrl + T) or filter the data the way you want by clicking the Filter button. After that, select the cell immediately below the column you want to total, and click the AutoSum button on the ribbon. A SUBTOTAL formula will be inserted, summing only the visible cells in the column.
=Sum(C:C)-Sum(C1:C5)
Sum everything then remove the sum of the values in the cells you don't want, no Volatile Offset's, Indirect's, or Array's needed.
Just for fun if you don't like that method you could also use:
=SUM($C$6:INDEX($C:$C,MATCH(9.99999999999999E+307,$C:$C))
The above formula will Sum only from C6 through the last cell in C:C where a match of a number is found. This is also non-volatile, but I believe more costly and sloppy. Just added it in case you'd prefer this anyways.
If you would like to do function like CountA for text using the last text value in a column you could use.
=COUNTIF(C6:INDEX($C:$C,MATCH(REPT("Z",255),$C:$C)),"T")
you could also use other combinations like:
=Sum($C$6:$C$65536)
or
=CountIF($C$6:$C$65536,"T")
The above would do what you ask in Excel 2003 and lower
=Sum($C$6:$C$1048576)
or
=CountIF($C$6:$C$1048576,"T")
Would both work for Excel 2007+
All above functions would simply ignore all the blank values under the last value.
You all seem to love complication. Just click on column(to select entire column), press and hold CTRL and click on cells that you want to exclude(C1 to C5 in you case). Now you have selected entire column C (right to the end of sheet) without starting cells. All you have to do now is to rightclick and "Define Name" for your selection(ex. asdf ). In formula you use SUM(asdf). And now you're done. Good luck
Allways find the easyest way ;)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With