explanation please

Holger

Board Regular
Joined
Nov 22, 2017
Messages
58
Office Version
  1. 365
Platform
  1. MacOS
Hi everyone,

I have found the below LET formula to calculate income tax in cell F2. While it works, I struggle to comprehend the Lambda part. Lambda uses income, start, end, rate as input. income refers to cell E2. What I don't understand is, how can the function calculate correct tax, if start, end, rate are nowhere defined.

What am I missing?

Thanks for anyone's help.

Book7
ABCDEF
1LowHighRateincometax
2010,00010%82,50015,030
31,00140,00012%
440,00185,00022%
585,001160,00024%
6160,00132%
Sheet1
Cell Formulas
RangeFormula
F2F2=LET( income, E2, brackets, A2:C6, bracketStart, INDEX(brackets, 0, 1), bracketEnd, INDEX(brackets, 0, 2), taxRate, INDEX(brackets, 0, 3), numBrackets, ROWS(brackets), taxCalculation, LAMBDA(income,start,end,rate, IF(income > start, MIN(income - start, end - start) * rate, 0) ), totalTax, SUM( MAP(bracketStart, bracketEnd, taxRate, LAMBDA(start,end,rate, taxCalculation(income, start, end, rate)) ) ), totalTax )
 
A bit more concise version that you can try.
Income Tax 2025a.xlsm
ABCD
1
2
3IncomeTaxTax
410,000.001,000.001,000.00
582,499.0013,949.7813,949.78
6200,000.0046,900.0046,900.00
71,000,000.00334,900.00334,900.00
8
1b
Cell Formulas
RangeFormula
C4:C7C4=Tax25a(B4)
D4:D7D4=LET(i,B4,b,{0;10000;40000;85000;160000},r,{0.1;0.02;0.1;0.02;0.12},SUM((i>b)*(i-b)*r))
Lambda Functions
NameFormula
Tax25a=LAMBDA(Income,LET(i,Income,b,{0;10000;40000;85000;160000},r,{0.1;0.02;0.1;0.02;0.12},SUM((i>b)*(i-b)*r)))



Income Tax 2025a.xlsm
ABCDEFG
1
2Income$82,499.00$13,949.78FromTax rate
3010%
410,00012%
540,00022%
685,00024%
7160,00036%
8
9
10
11Income
125,000.00500.00500.00
1310,000.001,000.001,000.00
1410,000.501,000.061,000.06
1582,499.0013,949.7813,949.78
1685,000.0014,500.0014,500.00
17200,000.0046,900.0046,900.00
181,000,000.00334,900.00334,900.00
19
1a
Cell Formulas
RangeFormula
D2D2=Tax25a(B2)
F12:F18F12=Tax25a(B12)
G12:G18G12=LET(i,B12,b,{0;10000;40000;85000;160000},r,{0.1;0.02;0.1;0.02;0.12},SUM((i>b)*(i-b)*r))
Lambda Functions
NameFormula
Tax25a=LAMBDA(Income,LET(i,Income,b,{0;10000;40000;85000;160000},r,{0.1;0.02;0.1;0.02;0.12},SUM((i>b)*(i-b)*r)))
 
Last edited:
Upvote 0

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Cell Formulas
RangeFormula
C2,C12:C18C2=Tax2025a($F$3:$G$7,B2)
D2D2=Tax25a(B2)
D12:D18D12=LET(rng,$F$3:$G$7,i,B12,b,INDEX(rng,,1),r,INDEX(rng,,2),ro,VSTACK(0,DROP(r,-1)),SUM((i>b)*(i-b)*(r-ro)))
E12:E18E12=SUM((B12>{0;10000;40000;85000;160000})*(B12-{0;10000;40000;85000;160000})*({0.1;0.02;0.1;0.02;0.12}))
F12:F18F12=Tax25a(B12)
G12:G18G12=LET(i,B12,b,{0;10000;40000;85000;160000},r,{0.1;0.02;0.1;0.02;0.12},SUM((i>b)*(i-b)*r))
Lambda Functions
NameFormula
Tax2025a=LAMBDA(rngRateData,TaxableIncome,LET(rng,rngRateData,i,TaxableIncome,b,INDEX(rng,,1),r,INDEX(rng,,2),ro,VSTACK(0,DROP(r,-1)),SUM((i>b)*(i-b)*(r-ro))))
Tax25a=LAMBDA(Income,LET(i,Income,b,{0;10000;40000;85000;160000},r,{0.1;0.02;0.1;0.02;0.12},SUM((i>b)*(i-b)*r)))
 
Upvote 0

Forum statistics

Threads
1,226,116
Messages
6,189,055
Members
453,523
Latest member
Don Quixote

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top