Excel-97 (workaround for VBA or Visual Basic)

dw85745

New Member
Joined
Oct 14, 2005
Messages
12
M$ killed the use of VBA and Visual Basic some time back for older versions of Excel.
I normally handle this by creating a VB program and then doing everything in Excel from VB,
I have a situation with multiple interrelated worksheets that I don't want to recreate in VB.
OF INTEREST is a tax table I need to reference, which calculates the amount of tax based on the final value in one cell.
Currently, I'm using the formula which just address the first two tax levels which reside in rows.

Excel Formula:
 =IF(C37 <= 0, 0, IF(AND(C37>$D$54, C37 < $D$55),((C37-$D$54)*$C$54)+$B$54,((C37-$D$55)*$C$55)+$B$55))

I need to expand this for other tax levels (rows), which would require a loop.

Any workaround or solution appreciated.
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
SUMPRODUCT is probably your answer... It's hard to replicate your example as you didn't provide the data, but this e.g. works:

Say you have 4 backets, add one column for the "total tax in previous brackets".
start (cell A1)endpercmax_prev
-6.000
10%​
0
6.00012.000
20%​
600 =D2+C2*(B2-A2)
12.00025.000
30%​
1.800 =D3+C3*(B3-A3)
25.000100.000
40%​
5.700 =D4+C4*(B4-A4)

Let's put the example income data in F2:F12:
amount (cell F1)max_prevpercin_bracketcalc
-1.000,000 =SUMPRODUCT(($A$2:$A$5<=F2)*($B$2:$B$5>F2)*($D$2:$D$5))
0% =SUMPRODUCT(($A$2:$A$5<=F2)*($B$2:$B$5>F2)*($C$2:$C$5))​
- =MAX(F2-SUMPRODUCT(($A$2:$A$5<=F2)*($B$2:$B$5>F2)*($A$2:$A$5)),0)- =G2+I2*H2
2.000,000
10%​
2.000,00200,00
5.000,000
10%​
5.000,00500,00
8.000,00600
20%​
2.000,001.000,00
11.000,00600
20%​
5.000,001.600,00
14.000,001.800
30%​
2.000,002.400,00
17.000,001.800
30%​
5.000,003.300,00
20.000,001.800
30%​
8.000,004.200,00
23.000,001.800
30%​
11.000,005.100,00
26.000,005.700
40%​
1.000,006.100,00
29.000,005.700
40%​
4.000,007.300,00

Basically you can use the SUMPRODUCT as a kind of filter/multiply.

Cheers
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,242
Members
452,623
Latest member
russelllowellpercy

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