本文介绍了变长系列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图确定是否可以在Excel中编写以下计算,其中n是变量并且来自用户输入. n的值为正且等于或大于1.是否可以编写公式而不是使用vba.
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
是否可以编写一个适用于任何n值的公式
Is it possible to write a formula that works for any value of n
谢谢
推荐答案
使用SUMPRODUCT
Use SUMPRODUCT
=SUMPRODUCT(2^ROW(INDEX(A:A,1):INDEX(A:A,A1)))
其中A1是用户要在其中输入所需数字的单元格.
Where A1 is the cell in which the user will put the desired number.
这篇关于变长系列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!