简体   繁体   English

LibreOffice Calc - 如何重用多步公式?

[英]LibreOffice Calc - How to reuse multi step formula?

I'm making a balance sheet, Sheet1 is for the ins and outs, and most values are added manually or simple formulas, and Sheet2 is where I created a formula, in the hopes of being able to reuse it.我正在制作资产负债表,Sheet1 用于输入和输出,大多数值是手动添加的或简单的公式,Sheet2 是我创建公式的地方,希望能够重用它。

I'm not an accountant to understand how I could make the calculations easier, and I'm a programmer, so I understand that the way I may be imagining the solution is likely impossible with the way Libreoffice Calc's formulas work.我不是会计师,不知道如何让计算变得更容易,而且我是一名程序员,所以我知道我想象的解决方案的方式对于 Libreoffice Calc 的公式工作方式可能是不可能的。

So, to explain a bit.所以,稍微解释一下。

On Sheet1, each column is a month, and the value is a tax that will appear one time each month, dependent on another value.在 Sheet1 上,每一列都是一个月,并且值是每月出现一次的税,取决于另一个值。

So, the base value is on ROW 17, and on 18, I would like that result to be set.因此,基值在第 17 行,在第 18 行,我希望设置该结果。 For every month, of course当然,每个月

On Sheet2, I have the function, it contains 5 steps, with the values being reused a lot (hence, simplifying everything into one line would be hell).在 Sheet2 上,我有 function,它包含 5 个步骤,其中的值被大量重用(因此,将所有内容简化为一行将是地狱)。 这是有问题的复杂公式,D1 是输入,C6 是输出。

This is the complex formula in question, D1 is the input, C6 is the output.这是有问题的复杂公式,D1 是输入,C6 是 output。

The formula below is the one used on C2, and repeated down to C5.下面的公式是在 C2 上使用的公式,并重复到 C5。

I would like to keep the constants as a table since it would be easier to update it in the future in case it suffer any changes.我想将常量保留为表格,因为将来更新它会更容易,以防它发生任何变化。

I have been searching for a possible solution but found none, and I believe that it's likely because I'm looking for a solution like a programmer (use Sheet as a function), and I should seek sort of way, but I don't know how Calc works.我一直在寻找可能的解决方案,但没有找到,我相信这很可能是因为我正在寻找像程序员这样的解决方案(使用 Sheet 作为函数),我应该寻求某种方式,但我没有知道 Calc 是如何工作的。

In regards to the calculation, I don't know the specific name, but the idea is, from 0 to A1, I have to B1% from A1-0, then from A2-A1, remove B2%, and so on.关于计算,我不知道具体的名字,但想法是,从0到A1,我必须从A1-0到B1%,然后从A2-A1,去掉B2%,以此类推。

Of course the formula's complexity comes from treating lower values, so for example, if D1 was 2K, then I would have to take 7.5% of R$ 96.02, and everything beyond is 0, since there is nothing remaining for them to calculate当然,公式的复杂性来自于处理较低的值,例如,如果 D1 是 2K,那么我将不得不取 96.02 雷亚尔的 7.5%,而超出的一切都是 0,因为他们没有什么可以计算的了

Most of the descriptions I found on MULTIPLE.OPERATIONS were confusing, but I found one that made it much easier to understand.我在 MULTIPLE.OPERATIONS 上找到的大多数描述都令人困惑,但我找到了一个更容易理解的描述。

The answer was to use this formula on Sheet1 :答案是在Sheet1上使用这个公式:

=MULTIPLE.OPERATIONS('Sheet2'.$C$6, 'Sheet2'.$D$1, C17)

I can just copy paste it to the side and the calculation will be executed properly.我可以将其复制粘贴到一边,计算将正确执行。

To explain the arguments:解释 arguments:

1 - where the result will appear 1 - 结果将出现的位置

2 - the location of the main/first formula variable 2 - 主/第一个公式变量的位置

3 - the location of dynamic variable you want to insert in that formula (So this is from Sheet1) 3 - 您要在该公式中插入的动态变量的位置(所以这是来自 Sheet1)

More arguments could be used if more variables were needed, but I just needed one.如果需要更多变量,可以使用更多 arguments,但我只需要一个。

This is the place with the best explanation I found for the function.这是我为 function 找到的最佳解释的地方。

https://wiki.documentfoundation.org/Documentation/Calc_Functions/MULTIPLE.OPERATIONS https://wiki.documentfoundation.org/Documentation/Calc_Functions/MULTIPLE.OPERATIONS

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

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