Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help on Round Off value
#3
Solved: 11 Years, 6 Months, 3 Weeks ago
It looks like your rule is that your value is above n50, round up to the nearest 100, else round down to the nearest 100. For example, 140 rounds down to 100, 160 rounds up to 200. 240 rounds down to 200, 260 rounds up to 300. If that's true, you can do this:

Code:
Function RoundBill(billAmount)
  billHundreds=fix(billAmount/100)
  billRemaining=billAmount-(billHundreds*100)
  if billRemaining < 50 then
      RoundBill=(billHundreds)*100
  else
      RoundBill=(billHundreds+1)*100
  end if
End Function

billAmount=RoundBill(140)
billAmount=RoundBill(160)
billAmount=RoundBill(123)
billAmount=RoundBill(1780)
Reply


Messages In This Thread
Help on Round Off value - by AutomationTester2011 - 07-19-2011, 05:11 PM
RE: Help on Round Off value - by rajpes - 07-19-2011, 05:37 PM
RE: Help on Round Off value - by tdevick - 07-19-2011, 10:10 PM
RE: Help on Round Off value - by rajpes - 07-19-2011, 10:41 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)