如何使用Google表格公式根据税率计算价值?

huangapple go评论103阅读模式
英文:

How to calculate value based on tax bracket using Google sheet formula?

问题

我想根据在Google表格中应用的税率来计算金额上的税款。以下是税率的截图:

如何使用Google表格公式根据税率计算价值?

如果金额为**$17000**,则应在前$14000上应用10.5%的税率,剩下的$3000应该应用17.50%的税率。我尝试了以下公式,但我认为这不是计算的最佳方式,J13单元格中有一个要计算的应税金额:

=IFS(J8<14001,14000*0.105,J8<48001,1470+(J8-14000)*0.175,J8<70001,7420+(J8-48000)*0.30)

我不想在公式中使用这个税表,因为我对公式的使用技能较低,无法设计一个不使用税表的最佳公式,非常感谢任何指导。

英文:

I want to calculate the tax on the amount based on tax bracket applied to it in Google sheet. Here is the screenshot of the tax bracket:
如何使用Google表格公式根据税率计算价值?

So if the amount is $17000, then 10.5% tax is applied on first $14000 and 17.50% tax should be applied on the remaining $3000. I have tried the following formula but I don't think this is the optimal way of calculating this, J13 cell has a value to be calulated for the taxable amount:

=IFS(J8&lt;14001,14000*0.105,J8&lt;48001,1470+(J8-14000)*0.175,J8&lt;70001,7420+(J8-48000)*0.30) and so on for other tax ranges

I donot want to use this tax table in the formula, due to my beginner skills with the formulas, I am unable to devise a optimal formula which works without using tac table, any guidance would be much appreciated.

答案1

得分: 3

以下是翻译好的部分:

  • 将税表排列如A列,B列,C列所示

  • 此示例情况(金额为$17000)的公式背后的计算如下:

    (14000*10.5%)+((17000-14001)*17.5%) = 1994.825

公式:

=ROUND(SUM(MAP(A1:A5,B1:B5,{C1:C4;99^99},LAMBDA(a,b,c,IFs(E1&gt;c,c-b,E1&gt;b,E1-b,TRUE,&quot;&quot;)*a))),2)

另一种方法:

=lambda(z,offset(z,2,0)+((E1-z)*offset(z,1,0)))(index(G1:K1,xmatch(E1,G1:K1,-1)))
英文:

Within Sheets here's one approach. Please do test it out with various scenarios to see if there's any amiss..

  • arrange the tax table as shown in Columns A,B,C

  • the calculation behind the formula for this example scenario (amount of $17000) is

    (14000*10.5%)+((17000-14001)*17.5%) = 1994.825

Formula:

=ROUND(SUM(MAP(A1:A5,B1:B5,{C1:C4;99^99},LAMBDA(a,b,c,IFs(E1&gt;c,c-b,E1&gt;b,E1-b,TRUE,&quot;&quot;)*a))),2)

如何使用Google表格公式根据税率计算价值?

Another approach:

=lambda(z,offset(z,2,0)+((E1-z)*offset(z,1,0)))(index(G1:K1,xmatch(E1,G1:K1,-1)))

如何使用Google表格公式根据税率计算价值?

答案2

得分: 1

=使用大括号在公式中创建表格。使用逗号分隔百分比和数值,使用分号分隔不同的百分比。您可以在第一行设置值为0,最后一行为999^99,这是一个超高的值,用于处理超过180,000美元的情况:

=LAMBDA(table,LET(l,MATCH(B1,INDEX(table,,2),1),INDEX(table,l,2)*INDEX(table,l,1)+(B1-INDEX(table,l,2))*INDEX(table,l+1,1)))
({10.5%,0;
10.5%,14000;
17.5%,48000;
30%,70000;
33%,180000;
39%,999^99})

作为数组:

=INDEX(IF(LEN(B1:B),LAMBDA(table,LET(l,MATCH(B1:B,INDEX(table,,2),1),INDEX(table,l,2)*INDEX(table,l,1)+(B1:B-INDEX(table,l,2))*INDEX(table,l+1,1)))
({10.5%,0;
10.5%,14000;
17.5%,48000;
30%,70000;
33%,180000;
39%,999^99}),&quot;&quot;))

如何使用Google表格公式根据税率计算价值?

英文:

You can try creating your table with curly brackets inside your formula. Use comma for dividing percentage and value, and semicolons to divide the different percentages. You can hav a first line with the value 0 and the last one with 999^99 which is an ultra-high value for the case when you overpass $180.000:

=LAMBDA(table,LET(l,MATCH(B1,INDEX(table,,2),1),INDEX(table,l,2)*INDEX(table,l,1)+(B1-INDEX(table,l,2))*INDEX(table,l+1,1)))
({10.5%,0;
10.5%,14000;
17.5%,48000;
30%,70000;
33%,180000;
39%,999^99})

如何使用Google表格公式根据税率计算价值?

As an array:

=INDEX(IF(LEN(B1:B),LAMBDA(table,LET(l,MATCH(B1:B,INDEX(table,,2),1),INDEX(table,l,2)*INDEX(table,l,1)+(B1:B-INDEX(table,l,2))*INDEX(table,l+1,1)))
({10.5%,0;
10.5%,14000;
17.5%,48000;
30%,70000;
33%,180000;
39%,999^99}),&quot;&quot;))

答案3

得分: 0

我已经重新排列了_rockinfreakshow_的答案,使其易于定制:

=LET(
  value_, income,
  upper_limits, WRAPROWS(limits,1),
  rates_, WRAPROWS(rates,1),
  lower_limits, MAKEARRAY(ROWS(upper_limits),1,LAMBDA(r,c,IF(r &gt;1,INDEX(upper_limits,r-1,c),0))),
  SUM(
    MAP(
      lower_limits, upper_limits, rates_, 
      LAMBDA(lower, upper, rate,
        IFS(
          AND(upper &gt; 0, value_ &gt; upper), upper - lower, 
          value_ &gt; lower, value_ - lower, 
          TRUE, 0
        )*rate
      )
    )
  )
)

请根据需要更改变量incomelimitsrates。我建议定义一个命名函数,就像我在这个示例电子表格中所做的那样。

如何使用Google表格公式根据税率计算价值?

英文:

I've rearranged rockinfreakshow's answer it in a LET expression so it is easy to customize:

=LET(
  value_, income,
  upper_limits, WRAPROWS(limits,1),
  rates_, WRAPROWS(rates,1),
  lower_limits, MAKEARRAY(ROWS(upper_limits),1,LAMBDA(r,c,IF(r &gt;1,INDEX(upper_limits,r-1,c),0))),
  SUM(
    MAP(
      lower_limits, upper_limits, rates_, 
      LAMBDA(lower, upper, rate,
        IFS(
          AND(upper &gt; 0, value_ &gt; upper), upper - lower, 
          value_ &gt; lower, value_ - lower, 
          TRUE, 0
        )*rate
      )
    )
  )
)

Change the variables income, limits and rates accordingly.
I recommend defining a named function like I've done in this sample spreadsheet
如何使用Google表格公式根据税率计算价值?

答案4

得分: 0

以下是代码部分的翻译:

=TAX(17000, {0,10.5%; 14000,17.5%; 48000,30%; 70000,33%; 180000,39%})

计算税额的核心是 SUMPRODUCT 函数,它接受两个数组作为参数。第一个数组包含应纳税金额超出每个税率档位的金额(如果金额低于档位则为0)。第二个数组包含每个连续档位的增量税率贡献。

在 OP 的示例中,传递给 SUMPRODUCT 的两个数组将是:

  • {17000; 3000; 0; 0; 0}
  • {10.5%; 7%; 12.5%; 3%; 6%}

税额是两个数组中相应元素的乘积之和:
17000×10.5% + 3000×7% + 0×12.5% + 0×3% + 0×6% = 1995。

英文:

The other answers are needlessly over-complicated. Use this named function:

> TAX(taxable, brackets)
>
> Computes the tax on a given taxable amount according to specified tax brackets.
>
> - taxable: The amount to be taxed. Example: 69420.
> - brackets: A 2-column array in which the first column contains the bracket cutoffs and the second column contains the tax rates. Example: {0,10%; 11000,12%; 44725,22%; 95375,24%; 182100,32%; 231250,35%; 578125,37%}.
>
>
&gt; =LET(
&gt; n, ROWS(brackets),
&gt; bounds, CHOOSECOLS(brackets, 1),
&gt; rates, CHOOSECOLS(brackets, 2),
&gt; SUMPRODUCT(
&gt; MAP(bounds, LAMBDA(bound, MAX(taxable - bound, 0))),
&gt; MMULT(ARRAYFORMULA(MUNIT(n) - MAKEARRAY(n, n, LAMBDA(r, c, r = c + 1))), rates)
&gt; )
&gt; )
&gt;

To compute the tax in OP's example:

=TAX(17000, {0,10.5%; 14000,17.5%; 48000,30%; 70000,33%; 180000,39%})

The meat of the calculation is the SUMPRODUCT call, which is passed two arrays. The first array contains the amounts by which the taxable amount exceeds each bracket cutoff (or 0 if the amount is less than the cutoff). The second array contains the incremental tax-rate contributions of each successive bracket.

In OP's example, the two arrays passed to SUMPRODUCT would be:

  • {17000; 3000; 0; 0; 0}
  • {10.5%; 7%; 12.5%; 3%; 6%}

The tax is the sum of the products of corresponding elements in the two arrays:
17000×10.5% + 3000×7% + 0×12.5% + 0×3% + 0×6% = 1995.

huangapple
  • 本文由 发表于 2023年2月27日 12:45:11
  • 转载请务必保留本文链接:https://go.coder-hub.com/75576846.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定