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.
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 | ||||||||
---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | |||
1 | Low | High | Rate | income | tax | |||
2 | 0 | 10,000 | 10% | 82,500 | 15,030 | |||
3 | 1,001 | 40,000 | 12% | |||||
4 | 40,001 | 85,000 | 22% | |||||
5 | 85,001 | 160,000 | 24% | |||||
6 | 160,001 | 32% | ||||||
Sheet1 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
F2 | F2 | =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 ) |