ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   formula with in cell reference (https://www.excelbanter.com/excel-discussion-misc-queries/169919-formula-cell-reference.html)

Lamb Chop

formula with in cell reference
 
A1 =5 B1=3
A2 =65
A3=12
....
....


How can I do this:


I want C1 have formula to do this:

the sum of A1 to A3

but if B1 change to 5 then

C1 = sum(A1:A5)

and when B1 change to 100
C1=sum(a1:A100)


ie. change the reference formula according to B1.

I have tried C1=sum(a1:A(B1))

but it does not work.





Carim[_2_]

formula with in cell reference
 
Hi,

Use :
=SUM(A1:OFFSET(A1,B1,0))

HTH

Lamb Chop

formula with in cell reference
 
Thanks Carim. You are very helpful.




"Carim" wrote in message
...
Hi,

Use :
=SUM(A1:OFFSET(A1,B1,0))

HTH





All times are GMT +1. The time now is 09:32 AM.

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