Jump to content

Rounding UP to nearest whole 50 or 100


This topic is 485 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Greetings

I have spent a fruitless couple of days searching, testing and generally getting frustrated... I’m relatively certain my problem is a simple one, however:

I am trying to calculate fuel required for a trip. It’s a simple Time/Speed/Distance calculation. The basic mathematics is in place and calculating accurately, so so-far, so-good. BUT, what I need the result to display as, is a whole number, Rounded UP to the nearest 50/100. So for example, if my TSD calculation returns a result of let’s say 716, I would want the result to display 750. Similarly if the calculation result is 751, I would require 800 to be displayed (an extreme example). 

This information is provided only as background detail for understanding: The reason for this is pretty much as old as aviation. We suffer from a fools-load of unit conversions, from airframe to airframe. For the airframes I have particularly in mind, the fuel on-board is displayed to us in lb’s. We order our fuel uplifts in litres. In very rough terms, with the error going in favour of a little more fuel on board than absolutely required, 60 litres JetA ordered gives us 100 lb uplift. So, if I have 450lb remaining and require 700lb for the next leg, I need an additional 250lb, for which I would request an uplift of 150 litres. Why I need to round to the nearest 50/100? Aircraft fuel gauges are not deathly accurate, particularly sitting on the ground. There’s always a little “fudge-factor” between what your gauges tell you and what’s actually onboard, mainly due to the attitude of the aircraft on the ground and it’s empty/loaded Centre of Gravity position during offloading/reloading operations. The gauges are best accurate in level, cruise flight. So, if you’re still with me, I want to round UP to the next 50/100 to add a little extra fuel to cover the “fudge factor” and give a little “Mum & the kids” fuel.

very grateful for any advice

 

 

Link to post
Share on other sites

Rounding a number up to the nearest multiple of 50 is easy =

Ceiling ( Number / 50 ) * 50

But if you want to keep the original number AND only display the rounded value, you will have to use an additional field for this.

 

 

Edited by comment
Link to post
Share on other sites
59 minutes ago, comment said:

Rounding a number up to the nearest multiple of 50 is easy...

 

 

I knew I wasn’t seeing the woods for the trees! Many thanks comment, that’s working perfectly. 

Regards

Link to post
Share on other sites

This topic is 485 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.