I´m working on two rewards programs for my employees.

One of them awards points by level. Level is determined by the number of transactions made by employee.

For example:

If employee made 22 transactions, he gets:

3 points for each of first 5 transactions (15 point total)

4 points for each of the following 5 transactions - 6 to 10 - (20 points total)

5 points for each of the following 5 transactions - 11 to 15 - (25 points total)

6 points for each transaction above 15. (42 points in this example)

Employee gets in total 92 points.

In the other program, employees get a reward (gift) for every 5 transactions.

In this case i need to keep track of gifts redeemed.

I´d appreciate any help.

Try

Let ( [

c = 22 ;

times3 = Min ( c ; 5 ) ;

times4 = Min ( c - times3 ; 5 ) ;

times5 = Min ( c - times3 - times4 ; 5 ) ;

times6 = Max ( 0 ; c - 15 )

] ;

times3 * 3 + times4 * 4 + times5 * 5 + times6 * 6

)

Actually, it's 102 …