PDA

View Full Version : Calculated Value - Remainder of a Division Function?



saeborne
2009-06-17, 02:07 PM
Hi All,

In MS Excel, there is a =MOD function, that will return the Modulus, or Remainder of a Division Function. For example:


=mod(NUMBER,DIVISOR)

* NUMBER is the number to divide (the left side of a division equation)

* DIVISOR is what you wish to divide the number by (the right side of a division equation)

For example, consider the following spreadsheet:

A1: =11/2
A2: =mod(11,2)

This will return the values:

A1: 5.5
A2: 1

Is there a function like this within Revit Calculated Values?

Thanks in advance.
Bryan

twiceroadsfool
2009-06-17, 03:28 PM
No, but you could make one if you dont mind a few extra calcuated value fields...

DivisionNumber = Numerator/Denominator (Number type)
DivisionInt = Numerator/Denominator (Integer type)
DivisionIntRount = if(DivisionInt>DivisionNumber, (DivisionInt-1), DivisionInt) (Integer Type... You need this in case it rounds up the division, you need it to always use the lower number)

DivisionRemainder = DivisionNumber-DivisionIntRound



I might have some syntax that isnt correct, but it should work...

saeborne
2009-06-17, 10:28 PM
That....


is...


AWESOME!!!!



Basically, that was the key that I needed to solve this puzzle.


The question... How do I round a value (in this case Room Areas) to achive two things:

1) Round to the nearest 5 SF.
2) Grand totals are Arithmetically correct, (not rounding correct)

The attached file has the schedule in it. In a nutshell, here's what I did:


Create a parameter "RoundFactor" (an integer, in this case 5)

AreaDivRF = Area / 1 SF / RoundFactor (Number parameter, to save the decimal places)

AreaDivInt = AreaDivRF / 1 (Integer Parameter, rounds to the nearest whole number)

AreaRounded = AreaDivInt * RoundFactor (Integer, gets me to the nearest 5)

Voila!




Now I can do things like schedule, "How many rooms do I have, that are approximately 165 sf?"

Or by changing the RoundFactor, I can round to the nearest 5, 10, 50, whatever!

I don't know, maybe it's already been solved on this board. But it was certainly an epiphany for me.

I <3 Math


Bryan

twiceroadsfool
2009-06-18, 12:28 AM
Math is great. The formuale capabilities in Revit are somewhat lacking, but it really doesnt matter too much. An extra five minutes of thought and you can get it to do just about anything. :)

Calculated values for rounding is much better than rounding, since you can then just total that column.value, instead of letting the total round itself seperately from the individual precise values.

Geeeeeeeeeeeeeeeeeeeeeeeks unite :)

Doni49
2015-09-04, 08:04 PM
Math is great. The formuale capabilities in Revit are somewhat lacking, but it really doesnt matter too much. An extra five minutes of thought and you can get it to do just about anything. :)

Calculated values for rounding is much better than rounding, since you can then just total that column.value, instead of letting the total round itself seperately from the individual precise values.

Geeeeeeeeeeeeeeeeeeeeeeeks unite :)

I realize this is an old thread and this may have been pointed out in a more recent posting (I haven't read through all the posts). But here's a simple way to get the remainder as well as the whole number portion of the quotient as well.

When you divide, you'll get a decimal value. The portion after the decimal is the remainder.

The rounddown function will round down to the nearest whole number (thus dropping the remainder).

Whole Number Quotient = rounddown(Numerator / Denominator)
Remainder = (Numerator / Denominator) - rounddown(Numerator / Denominator)

http://forums.augi.com/attachment.php?attachmentid=101967&stc=1