I am looking at creating a custom function to calculate transit time which goes by =roundup(miles/44,0) but then +10 for every 500 miles i.e.
0-500 is the base function
501-1000 is =roundup(miles/44,0)+10 and so forth to a cap of 5000 miles.
I know the base formula would be like this
Function TransitTime(Miles As Single) As Single
TransitTime = RoundUp(Miles / 44, 0)
End Function
But what is the process of creating an if statement for the mileage bands because I tried this below and it didn't work. Miles is what the cell will base the formula off of.
Function TransitTime(Miles As Single) As Single
If Miles < 500 Then
TransitTime = RoundUp(Miles / 44, 0)
Else
If Miles > 500 And Miles < 1000 Then
TransitTime = Round(RoundUp(Miles / 44, 0) + 10, 2)
Else
End Function
0-500 is the base function
501-1000 is =roundup(miles/44,0)+10 and so forth to a cap of 5000 miles.
I know the base formula would be like this
Function TransitTime(Miles As Single) As Single
TransitTime = RoundUp(Miles / 44, 0)
End Function
But what is the process of creating an if statement for the mileage bands because I tried this below and it didn't work. Miles is what the cell will base the formula off of.
Function TransitTime(Miles As Single) As Single
If Miles < 500 Then
TransitTime = RoundUp(Miles / 44, 0)
Else
If Miles > 500 And Miles < 1000 Then
TransitTime = Round(RoundUp(Miles / 44, 0) + 10, 2)
Else
End Function