ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   SUM function with row not known (https://www.excelbanter.com/excel-worksheet-functions/76045-sum-function-row-not-known.html)

Lokutus

SUM function with row not known
 

Hello,
I have a problem with SUM function in my sheet. The sheet is a template
that I use to export some data into it from external database. Then I
need to count some values. But in design time, I don't know, how many
rows it will be after exporting data. I need to prepare a cell with
SUM(H1:H...someRow) function. My export script will set a value of X1
cell to row count e.g. 52.
How can I use value in X1 as a last row for my SUM function.

SUM(H1:ADDRESS(X1;8)) doesn't work.

Any idea to solve it? Thanks in advance.
Lokutus


--
Lokutus
------------------------------------------------------------------------
Lokutus's Profile: http://www.excelforum.com/member.php...o&userid=32270
View this thread: http://www.excelforum.com/showthread...hreadid=520226


Bob Phillips

SUM function with row not known
 
=SUM(H:H)

or

=SUM(OFFSET(H1,,,COUNTA(H:H),1)

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Lokutus" wrote in
message ...

Hello,
I have a problem with SUM function in my sheet. The sheet is a template
that I use to export some data into it from external database. Then I
need to count some values. But in design time, I don't know, how many
rows it will be after exporting data. I need to prepare a cell with
SUM(H1:H...someRow) function. My export script will set a value of X1
cell to row count e.g. 52.
How can I use value in X1 as a last row for my SUM function.

SUM(H1:ADDRESS(X1;8)) doesn't work.

Any idea to solve it? Thanks in advance.
Lokutus


--
Lokutus
------------------------------------------------------------------------
Lokutus's Profile:

http://www.excelforum.com/member.php...o&userid=32270
View this thread: http://www.excelforum.com/showthread...hreadid=520226




Aladin Akyurek

SUM function with row not known
 
=SUM(H1:INDEX(H:H,X1))

Lokutus wrote:
Hello,
I have a problem with SUM function in my sheet. The sheet is a template
that I use to export some data into it from external database. Then I
need to count some values. But in design time, I don't know, how many
rows it will be after exporting data. I need to prepare a cell with
SUM(H1:H...someRow) function. My export script will set a value of X1
cell to row count e.g. 52.
How can I use value in X1 as a last row for my SUM function.

SUM(H1:ADDRESS(X1;8)) doesn't work.

Any idea to solve it? Thanks in advance.
Lokutus




All times are GMT +1. The time now is 03:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com