# Rounding UP to nearest whole 50 or 100

## 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.

##### Share on other sites
Posted (edited)

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

##### 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

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×

×
×
• Create New...