ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Variable in Excel Sum formula (https://www.excelbanter.com/excel-discussion-misc-queries/79875-variable-excel-sum-formula.html)

KMR

Variable in Excel Sum formula
 
I have a list of rows with columns A1 to H1. Based on some criteria, I need
to sum from A1 to H1 or E3 to H3 or any possibility. If I store the
beginning cell in a cell like J1 or J3, how can I use the value of the cell
and not the cell itself? I want something like sum(actual value of
cell(J1):ending cell))

Peo Sjoblom

Variable in Excel Sum formula
 
You can use index

=SUM(INDEX(A1:H3,1,5):INDEX(A1:H3,1,8))

replace 1,5 and 1, 8 with cells where you put the numbers
the above will sum E1:H1, 1 is the row number and 5 starting column (E) and
8 ending (H)

it's better to use this instead of indirect or offset since it is
non-volatile


--

Regards,

Peo Sjoblom


"KMR" wrote in message
...
I have a list of rows with columns A1 to H1. Based on some criteria, I
need
to sum from A1 to H1 or E3 to H3 or any possibility. If I store the
beginning cell in a cell like J1 or J3, how can I use the value of the
cell
and not the cell itself? I want something like sum(actual value of
cell(J1):ending cell))




Bob Phillips

Variable in Excel Sum formula
 
=SUM(INDIRECT(J1&":H1"))

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)

"KMR" wrote in message
...
I have a list of rows with columns A1 to H1. Based on some criteria, I

need
to sum from A1 to H1 or E3 to H3 or any possibility. If I store the
beginning cell in a cell like J1 or J3, how can I use the value of the

cell
and not the cell itself? I want something like sum(actual value of
cell(J1):ending cell))





All times are GMT +1. The time now is 02:18 PM.

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