Rounding in Merge Fields

M

MacTheKnife

I'm using the following code in a Merge document to 1)
apply disregards to an annual income and then 2) change
the annual income into a weekly income.

£{ = {mergefield grossamount}- {mergefield
firsrdisregard}- {mergefield seconddisregard} } divided
by { mergefield noofweeks } = £{ = { = {mergefield
grossamount}- {mergefield firstdisregard}- {mergefield
seconddisregard} / {mergefield noofweeks}

However, does anyone know what to add to make sure that
all fractions of a penny are always rounded down to the
nearest penny?

Thanks in advance
 
P

Peter Jamieson

Generaly speaking you should be able to round the result explicitly using
e.g.

{ =int(thenumber/0.01+.5)*0.01 }

or

{ =int((thenumber/0.01)+.5)*0.01 }

if you want to make the operator precedence obvious

--
Peter Jamieson - Word MVP

I'm using the following code in a Merge document to 1)
apply disregards to an annual income and then 2) change
the annual income into a weekly income.

£{ = {mergefield grossamount}- {mergefield
firsrdisregard}- {mergefield seconddisregard} } divided
by { mergefield noofweeks } = £{ = { = {mergefield
grossamount}- {mergefield firstdisregard}- {mergefield
seconddisregard} / {mergefield noofweeks}

However, does anyone know what to add to make sure that
all fractions of a penny are always rounded down to the
nearest penny?

Thanks in advance
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top