簡體   English   中英

如何計算占總數的百分比,當總數包括百分比時——循環計算

[英]How to calculate the percentage of the total, when the total includes the percentage -circular calculations

對於這個問題,需要計算最終的合同價格。

令 c 為合同價格 = 例如 100 i = 利息(c 的 1%) g = 另一個百分比(例如 c 的 1%)

然而,總合同價格需要使用 c + i + g 的 i 和 g 來計算。 換句話說,最終值必須包括計算 i 和 g(百分比)占 c+i+g 總和的總和。 這可能嗎?

由於我們需要先計算 i 和 g,這似乎是不可能的/循環的。

我試圖在 python 中創建一些東西來模擬這個,但我們真正想要的是 excel 中的解決方案。

有沒有人能夠闡明這種似乎取決於未來價值的循環計算?

def totalcontractprice(c,i,g):
    x=c+i+g
    return x

def finalcontractprice(totalcontractprice):
    #here we want to return the finalcontract price
    #this should recalculate i and g as percentages of x (totalcontractprice)



c=100
i=1 #1 percent of c
g=1 #1 percent of c


print(totalcontractprice(c,i,g))

這可以使用迭代計算選項在 Excel 中解決。 在 Excel 選項 > 公式 > 計算選項下,啟用迭代計算:

在此處輸入圖像描述

在啟用迭代計算之前,您會收到“循環引用”錯誤:

在此處輸入圖像描述

開啟迭代計算后,Excel會計算:

在此處輸入圖像描述

公式視圖以更好地查看循環:

在此處輸入圖像描述

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM