# Formula Help

##### Well-known Member
Hi Guy's i have this spreadsheet that i need help with. The INPUT cells are F2 and G2.
I need the formula in cell in I2. Would it better to do a macro? for this result?
If Miles 1-400 and G = 1 then 15%
If Miles 1-400 and G = 2 then 8.5%
If miles 401-600 and G = 1 then 20.2%
IF Miles 401-600 and G= 2 then 13%
If Miles 601 > and G = 1 or 2 then 13%
If G = 3 then 0%
BVL Accrual Master.xls
ABCDEFGHI
2\$0.00
3
4IfMiles1-400andG=1then15%
5IfMiles1-400andG=2then8.5%
6Ifmiles401-600andG=1then20.2%
7IFMiles401-600andG=2then13%
8IfMiles601>andG=1or2then13%
9IfG=3then0%
10
Waybill Detail
[/code]

### Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

#### iggydarsa

##### Well-known Member
try this formula and change the number formating of column I to "percantage":

=IF(AND(F2>=1, F2<=400), IF(G2=1, 15%, IF(G2=2, 8.5%, "")), IF(AND(F2>=401, F2<=600), IF(G2=1, 20.2%, IF(G2=2, 13%, "")), IF(AND(F2>=601, OR(G2=1, G2=2)), 13%, IF(G2=3, 0%, ""))))

#### barry houdini

##### MrExcel MVP
If you create a table with the mileages and possible values for G2 and insert the relevant percentages like below.....
Book1
ABCDEFGHIJ
1Miles123
2015%8.50%0%521120.20%
340120.20%13%0%
460113%13%0%
5
Sheet3

Formula in I2

=INDEX(\$B\$2:\$D\$4,MATCH(F2,A\$2:A\$4),MATCH(G2,B\$1:D\$1,0))

##### Well-known Member
try this formula and change the number formating of column I to "percantage":

=IF(AND(F2>=1, F2<=400), IF(G2=1, 15%, IF(G2=2, 8.5%, "")), IF(AND(F2>=401, F2<=600), IF(G2=1, 20.2%, IF(G2=2, 13%, "")), IF(AND(F2>=601, OR(G2=1, G2=2)), 13%, IF(G2=3, 0%, ""))))

This works GREAT... Thank you SO Much Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

### Forum statistics

1,164,525
Messages
5,837,867
Members
430,519
Latest member
abtg1 ### 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.

### Which adblocker are you using?    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

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