需要帮助将多单元格 Excel 公式转换为基本伪代码 [英] Need help converting a Multi-Cell Excel formula to basic pseudo code

查看:35
本文介绍了需要帮助将多单元格 Excel 公式转换为基本伪代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不认为整个电子表格在这里是相关的(希望我没有错)但基本上我正在处理一些财务数据并且需要计算出累积成本".电子表格是正确的,但我不明白公式的数学原理,所以我希望有人能把它分解成 BODMAS 或伪代码或其他东西(甚至是最终会变成的 Java.)

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.)

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

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

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

等等.

我想我只需要提供一个公式,但只是提供一些上下文.

I think I only needed to supply one formula, but just giving a few more for context.

所以上面的公式可以在 E 列中找到:表格截图

So the formulas above are found in column E: Screenshot of Table

谢谢!

推荐答案

公式的一部分,/100+1,从百分比变化转换而来.-1)*100 部分转换为百分比变化.PRODUCT() 将数字相乘.

The part of the formula, /100+1, converts from a percentage change. The part, -1)*100, converts to a percentage change. PRODUCT() multiplies the numbers togther.

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.

这篇关于需要帮助将多单元格 Excel 公式转换为基本伪代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆