Reply
 
Thread Tools Display Modes
  #1   Report Post  
SSwan
 
Posts: n/a
Default Rounding up in Mergefields

Hello.

Sheets is a mergefield of any positive value. I need to divide this value by
25 each time but need it to round the result up everytime to a whole number.

e.g. if sheets = 5, I need the result to be 1
e.g. if sheets = 26, I need the result to be 2 etc.

This is my code thus far:

{ =({MERGEFIELD sheets}/25 \# 0}

Any help would be appreciated. Thanks.
  #2   Report Post  
macropod
 
Posts: n/a
Default

Hi,

Word doesn't have a roundup/down function, but you can simulate one with a
bit of field maths:
{=ROUND(({MERGEFIELD sheets}/25+(MOD({MERGEFIELD
sheets},25)0)/2/25),0)*25}

See my Word Field Maths 'tutorial' at:
http://www.wopr.com/cgi-bin/w3t/show...?Number=365442
for more details.

Cheers


"SSwan" wrote in message
...
Hello.

Sheets is a mergefield of any positive value. I need to divide this value

by
25 each time but need it to round the result up everytime to a whole

number.

e.g. if sheets = 5, I need the result to be 1
e.g. if sheets = 26, I need the result to be 2 etc.

This is my code thus far:

{ =({MERGEFIELD sheets}/25 \# 0}

Any help would be appreciated. Thanks.



  #3   Report Post  
SSwan
 
Posts: n/a
Default

Thanks, I tried that but with a test input of 2, 5, 25, 26, 50, 54, 75, 845 I
got answers of 0, 0, 25, 25, 50, 50, 75, 850 instead of 1, 1, 1, 2, 2, 3, 3,
34???

Doesn't WOPR send Woodys watch etc? I get that.

....

"macropod" wrote:

Hi,

Word doesn't have a roundup/down function, but you can simulate one with a
bit of field maths:
{=ROUND(({MERGEFIELD sheets}/25+(MOD({MERGEFIELD
sheets},25)0)/2/25),0)*25}

See my Word Field Maths 'tutorial' at:
http://www.wopr.com/cgi-bin/w3t/show...?Number=365442
for more details.

Cheers


"SSwan" wrote in message
...
Hello.

Sheets is a mergefield of any positive value. I need to divide this value

by
25 each time but need it to round the result up everytime to a whole

number.

e.g. if sheets = 5, I need the result to be 1
e.g. if sheets = 26, I need the result to be 2 etc.

This is my code thus far:

{ =({MERGEFIELD sheets}/25 \# 0}

Any help would be appreciated. Thanks.




  #4   Report Post  
Greg
 
Posts: n/a
Default

SSwan,

Macropod will most likely be back to sort you out with his method. In
the meantime this appears to work:

{=INT({TEST}/25 + { IF { =MOD({ Test},25)} "0""1""0" }) }

  #5   Report Post  
SSwan
 
Posts: n/a
Default

Thank you very much Greg. It works a treat.

Kindest regards.

"Greg" wrote:

SSwan,

Macropod will most likely be back to sort you out with his method. In
the meantime this appears to work:

{=INT({TEST}/25 + { IF { =MOD({ Test},25)} "0""1""0" }) }


Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How I write a complex equation using mergefields in Word 2000? DDgolf18 Mailmerge 1 September 27th 05 11:40 PM
Replace mergefields with form fields jassi_Hayre Mailmerge 1 August 16th 05 10:49 PM
Rounding DR Tables 2 December 13th 04 08:33 PM
Working with Mergefields Duncan McDonald New Users 1 November 25th 04 01:25 PM
Rounding Down in Word macropod Tables 0 October 26th 04 10:22 AM


All times are GMT +1. The time now is 08:08 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"