I am trying to display the total sum of all the numbers for a particular column. I want the sum to be displayed above the column as follows:
21 30
A B
6 5
6 10
6 10
3 5
I know I can sum the values and display it at the bottom of the column using =SUM(A3:INDIRECT("D"&ROW()-2))
, however I am not getting a way to display it at the top of the column.
Please guide.
When I'm doing something like this, I prefer to not include any empty cells beneath the range I'm summing, because I've had errors in the past as the result of including them (usually because there's a cell way down in the column somewhere that I'm not expecting to have a value). I'm assuming that
A
&B
are your column headers. Assuming that, here is how I would do it. This is your formula for cellA1
:Explanation
I'm updating this with a brief explanation, per the OP's request.
According to ExcelFunctions.net:
The function reference for
OFFSET
is:What this formula does is create a dynamic range based on the number of cells in the selection, relative to cell
A$1
. This is an offset of two rows and no columns, which starts the range atA$3
. The height of the range is the total number of filled cells in the rangeA$3:A$65535
. The assumption here is that there are no blank cells in the range, which there were not in the sample data.