6 Replies Latest reply on May 14, 2015 4:30 PM by AndrewJudd

Rounding a calculation field

Title

Rounding a calculation field

Post

hi all, I have a calculation field which calculates mm - inches. The mm field in this case is called "H" and to get it to inches I have it as H *.03937.

This works fine for the maths, however how do I round to the nearest 0.5? I have tried something like:

Round (H *.03937 ; precision) but it thinks precision is a field.. any ideas?

• 1. Re: Rounding a calculation field

Use a constant for the field such as:

Round ( H * 0.03937 ; 1 )

to round it to one decimal place

• 2. Re: Rounding a calculation field

Thank you, how would i round it to the nearest quarter or half? So 2200mm gets 86.5 for example..?

• 3. Re: Rounding a calculation field

Int(Number) + Choose(Int(Mod(Number, 1) /.25), 0, .25, .50,.75)

This is from a KnowledgeBase article: http://help.filemaker.com/app/answers/detail/a_id/3125/kw/round

• 4. Re: Rounding a calculation field

Thanks, yes I found that but haven't managed to get the formula quite correct, it says too many parametres or too many ( etc.. This is what I have.. is it close?

Int (H*.03937) + Choose (Int (Mod (H*.03937, 1) / .25, 0, .25, .50, .75)

• 5. Re: Rounding a calculation field

Int (H*.03937) + Choose (Int (Mod (H*.03937, 1) / .25), 0, .25, .50, .75)

• 6. Re: Rounding a calculation field

Thank you