Thread: Range Formula
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Range Formula

1) Make sure the code is in a VBA module (not this workbook or one of the
sheets). Al
2) Does other macros run in the workbook? Make sure security level is set
to medium or low.

The code is working for me.

"Hamed parhizkar" wrote:

Please look below, I did all of this but in the cell it comes up with an error
#NAME?

What do I do?


Use a VBA function like the one below
call with
=bonus(b26,b27)

Function bonus(budget, actual)

Select Case (actual - budget)

Case -15 To -11
bonus = 1000
Case -10 To -4
bonus = 1500
Case -5 To -1
bonus = 1750
Case 0 To 4
bonus = 2000
Case 5 To 9
bonus = 2250
Case 10 To 14
bonus = 2500
Case 15 To 19
bonus = 3000
Case 20 To 24
bonus = 3250
Case 25 To 29
bonus = 3500
Case 30 To 34
bonus = 4000
Case 35 To 1000
bonus = 4500
End Select


End Function


"Hamed parhizkar" wrote:

I need help, I am trying to do a bonus calculation for Budget and Atual sales.

In b26 i have actual sales and in b27 budget.

Here is what i am trying to do.

Budgeted Unit sales bonus

-15 to -11= $1000
-10 to -4 = 1500
-5 to -1= $1750
0 to +4= $2000
+5 to +9= $2250
+10 to +14= $2500
+15 to +19= $3000
+20 to +24= $3250
+25 to +29= $3500
+30 to +34= $4000
+35 and over = $4500

So the above is saying for example if actual sales is 15 to 19 units above
budget then the payout is $3000.

Please help me.

Thanks,

Hamed Parhizkar