help with formula

dougdc3

New Member
Joined
Jan 9, 2016
Messages
8
I am trying to create a tool in excel that will calculate a payment based on # of credits achieved based on the table below.
For example:
50 credits = $1,000
250 credits = $1,500
Any credit amount greater than or equal to 50, and less than 250 would be $1000.
Any credit amount greater than or equal to 250, and less than 500 would be $1,500.
Etc etc.

The excel sheet would start with a question asking a user to input the number of credits they have (cell labeled credits) and then would automatically provide the payment in a cell marked "payment"

Payment would be calculated based on the formulas above (referencing the table below)
The table is going to have numbers in the millions which is why I need a formula...


Credits Payment
50$1000
100
150
200
250$1500
300
350
400
450
500$2000
550
600
650
700
750$2500
800
850
900
950
1000$3000

<tbody>
</tbody>
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Maybe

Formula
=IF(A2<50,0,1000+INT(A2/250)*500)

Where A2 houses the # of credits

M.
 
Last edited:
Upvote 0
Hello,

So is the maximum payout $3000? or can the user accrue an infinite amount of credits?

If the user enters the numbers of credits they have, do you need to keep a record of what the answer was? or just display it in the "Payment" cell?

Also, if for example... the user entered 950 credits. Should the payout display $2500? or $2900?
 
Upvote 0
Short bit of code to do what I think you want it to do. This just returns the value in a MsgBox to the user. Easy enough to change to write it to a "Payment" cell

Code:
Sub PayoutCalculator()


Dim UserCredits As Long
Dim Payout As Long


UserCredits = InputBox("How many credits do you have?", "Payout Calculator")


    If UserCredits < 50 Then
        Payout = 0
        MsgBox "Unfortunately you don't have enough points for your first payout!"
    Else
        Payout = (1000 + Int(UserCredits / 250) * 500)
        MsgBox "Your credit value has a payout amount of $" & Payout & "!"
    End If
    
End Sub
 
Upvote 0
thank you - here is a link to the actual spreadsheet (I initially tried to include a picture but did not work)

https://www.dropbox.com/s/daa99lhi5jpqkh5/credit table 2016.xlsx?dl=0

Took a quick look, you increment criteria seem to have changed. Also there seems to be an erroneous(?) $1000 grant at 200 credits. Or is that intentional?

From what I can tell.. the grant total is $1000, for the first 40 credits.

Then every 40 credits, add $500 to the grant total

40 credits - $1000
80 credits - $1500
120 credits - $2000
160 credits - $2500
200 credits - $3000

etc.

If this is the case, you do not need to have them listed in the spreadsheet as calculated values. You can simply have 2 cells. one to enter the credits, the second to work out the grant total.
 
Upvote 0
If the assumptions in the above post are true. Please copy this code into the active worksheet VBA section. The section under where the variables are declared enables you to change the levels of payout and payout amounts on the fly.

Enter the amount of user credits in Cell F4 and it will display the payout amount in cell F5 when you hit enter!

Hope this helps


Code:
Private Sub Worksheet_Change(ByVal Target As Range)


If Not Intersect(Target, Target.Worksheet.Range("F4")) Is Nothing Then


    Dim UserCredits As Long
    Dim Payout As Long
    Dim CreditIncrement As Integer
    Dim PayoutIncrement As Integer
    Dim InitialIncrement As Integer
    
    CreditIncrement = 40 ' This sets when the payouts increase, so every 40 credits in this example
    InitialIncrement = CreditIncrement 'Required for first if statement condition
    PayoutIncrement = 500 'How much each Payout increases
     
    UserCredits = ActiveSheet.Range("F4").Value 'Read the value in cell F4
    
        If UserCredits < InitialIncrement Then
            Payout = 0
            ActiveSheet.Range("F5") = "$" & Payout
        
        ElseIf UserCredits = InitialIncrement Then
            Payout = 1000
            ActiveSheet.Range("F5") = "$" & Payout
        
        Else
            Payout = (1000 + (Int(UserCredits / CreditIncrement) - 1) * PayoutIncrement)
            ActiveSheet.Range("F5") = "$" & Payout
        End If
End If


    
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,506
Messages
6,125,194
Members
449,214
Latest member
mr_ordinaryboy

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