Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Variable length series

Tags:

excel

I am trying to determine if it is possible to write the following calculation in Excel where n is variable and comes from user input. The value of n is positive and equal to or greater than 1. Is it possible to write a formula rather than using vba.

2^1 + 2^2 + 2^3 + ...... + 2^n
If n = 1 then the calculation would be 2^1
If n = 2 then the calculation would be 2^1 + 2^2
If n = 3 then the calculation would be 2^1 + 2^2 + 2^3

Is it possible to write a formula that works for any value of n

Thanks

like image 511
user3673417 Avatar asked Dec 11 '25 16:12

user3673417


2 Answers

Use SUMPRODUCT

 =SUMPRODUCT(2^ROW(INDEX(A:A,1):INDEX(A:A,A1)))

Where A1 is the cell in which the user will put the desired number.

like image 135
Scott Craner Avatar answered Dec 13 '25 09:12

Scott Craner


Try this formula :

=2^(A1+1)-2

like image 28
barry houdini Avatar answered Dec 13 '25 09:12

barry houdini