Forum

Notifications
Clear all

Travel allowance

5 Posts
4 Users
0 Reactions
169 Views
(@rathanak)
Posts: 55
Trusted Member
Topic starter
 

Pls... Need help on below excel formula~ 

 

Example I went to travel 19 days and travel allowance base on this:

 

1-5 days - claim 40 per day

6-10 days - claim 50 per day 

11-15 days- claim 60 per day

16-20 days - claim 70 per day

 

Answer is 40x5 days + 50x5days + 60x5days + 70x4days

 

1030 in total

 

Anyone hv the idea on this formula?

 
Posted : 12/07/2016 10:19 am
(@candybg)
Posts: 1
New Member
 

This can be written as a single formula, a bit complicated.

Can you use helper columns? If so, the formula can be simplified and you can more easily have cells with the various rates so they could be changed as needed.

 
Posted : 12/07/2016 12:15 pm
(@fravis)
Posts: 337
Reputable Member
 

Undoubtly there must be a clever formula for that, but maybe something easy as this example can help you further?

(I hope you get to see the file, it's a bit strange how this uploading works)

 
Posted : 12/07/2016 2:53 pm
(@sunnykow)
Posts: 1417
Noble Member
 

You can choose the UDF way :

Function Allowance(NoOfDays)
Select Case NoOfDays
Case Is <= 5
Allowance = NoOfDays * 40
Case Is <= 10
Allowance = 200 + ((NoOfDays - 5) * 50)
Case Is <= 15
Allowance = 450 + ((NoOfDays - 10) * 60)
Case Else
Allowance = 750 + ((NoOfDays - 15) * 70)
End Select

End Function

or with a formula where A2 is the number of days

=IF(A2<=5,A2*40,IF(A2<=10,200+((A2-5)*50),IF(A2<=15,450+((A2-10)*60),(750+((A2-15)*70)))))

The assumption is that on the 16th day and there after, the rate is 70 per day

Sunny Kow

 
Posted : 12/07/2016 7:41 pm
(@rathanak)
Posts: 55
Trusted Member
Topic starter
 

Thanks,I use if condition I never use UDF 

 

SunnyKow said
You can choose the UDF way :

Function Allowance(NoOfDays)
Select Case NoOfDays
Case Is <= 5
Allowance = NoOfDays * 40
Case Is <= 10
Allowance = 200 + ((NoOfDays - 5) * 50)
Case Is <= 15
Allowance = 450 + ((NoOfDays - 10) * 60)
Case Else
Allowance = 750 + ((NoOfDays - 15) * 70)
End Select

End Function

or with a formula where A2 is the number of days

=IF(A2<=5,A2*40,IF(A2<=10,200+((A2-5)*50),IF(A2<=15,450+((A2-10)*60),(750+((A2-15)*70)))))

The assumption is that on the 16th day and there after, the rate is 70 per day

Sunny Kow 

 
Posted : 12/07/2016 9:00 pm
Share: