简体   繁体   English

需要帮助将多单元Excel公式转换为基本伪代码

[英]Need help converting a Multi-Cell Excel formula to basic pseudo code

I don't think the whole spreadsheet is relevant here (Hope I am not wrong) but essentially I am working with some financial figures and need to work out a "Cumulative Cost". 我认为整个电子表格在这里不相关(希望我没错),但从本质上讲,我正在处理一些财务数据,并且需要计算出“累积成本”。 The spreadsheet is correct, but I don't understand the maths of the formula, so I hope somebody can break it down into BODMAS or pseudo code or something (or even Java which it will ultimately be.) 电子表格是正确的,但是我不了解该公式的数学原理,因此我希望有人可以将其分解为BODMAS或伪代码之类的东西(甚至最终可以是Java的东西)。

{=(PRODUCT($D$4:D7/100+1)-1)*100}

{=(PRODUCT($D$4:D8/100+1)-1)*100}

{=(PRODUCT($D$4:D9/100+1)-1)*100}

etc.. 等等..

I think I only needed to supply one formula, but just giving a few more for context. 我认为我只需要提供一个公式,而仅提供一些更多的上下文即可。

So the formulas above are found in column E: Screenshot of Table 因此,以上公式可在E列中找到: 表格的屏幕截图

Thanks! 谢谢!

The part of the formula, /100+1 , converts from a percentage change. 公式的一部分/100+1从百分比变化转换。 The part, -1)*100 , converts to a percentage change. -1)*100部分转换为百分比变化。 PRODUCT() multiplies the numbers togther. PRODUCT()将数字相乘。

double d[12], e[12]; // input and output arrays, respectively
double p = 1.0; // to accumulate the product

for (i = 0; i < 12; i++)
{
    p = p * ((d[i] / 100) + 1);  // convert from percentage and multiply
    e[i] = (p - 1) * 100;        // convert to percentage
}

Additional ( and ) and spaces added for clarity. 为了清楚起见,添加了其他()和空格。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM