Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

Here's my scenario, I need to divide a number that could result as nearest as 12 but nut exceed to 12

Example

50 / 5 = 10

70 / 7 = 11.66

What i need is the divisor to put so the result would be as nearest as 12 not equal or greater than 12.

 

Posted (edited)
4 hours ago, archrid404 said:

70 / 7 = 11.66

I don't think so.

Assuming you want a whole divisor that returns a result closest to 12 but never equal to or greater than 12, start by dividing the number by 12. If the result is a whole number, bump it up by 1. Otherwise bump it up to the nearest whole number:

Let ( 
divisor = number / 12 
;
If ( Mod ( divisor ; 1 ) ; Ceiling ( divisor ) ; divisor + 1 )
)

Or shortly:

Div ( number ; 12 ) + 1

This will produce a divisor of 5 for the number 50 (50/5 = 10) and 6 for the number of 70 (70/6=11.6666666666666667).

 

Edited by comment

This topic is 1882 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.