Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-12-2023, 11:13 AM
vanishingpoint vanishingpoint is offline How to round a number merged from access to a word table Windows 11 How to round a number merged from access to a word table Office 2021
Novice
How to round a number merged from access to a word table
 
Join Date: Apr 2023
Posts: 3
vanishingpoint is on a distinguished road
Default How to round a number merged from access to a word table


Thanks to @macropod #macropod, I understand rounding to the nearest five.

{=ROUND((SUM(5,6,7)/5,0)*5}

How can I do this with a {MERGEFIELD} from Access into a Word table cell?
Reply With Quote
  #2  
Old 04-12-2023, 05:00 PM
Guessed's Avatar
Guessed Guessed is offline How to round a number merged from access to a word table Windows 10 How to round a number merged from access to a word table Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Word fields are not a great place to do mathematical calculations so I would prefer to address this via the SQL query (either in Word's merge or by creating the query in Access and then linking to that query in the Merge). For instance, this SQL works to round to nearest 5
Code:
SELECT [Last Name], [First Name], [Number1], [Number2], (Round([Number1]/5,0))*5 AS Num1, (Round([Number2]/5,0))*5 AS Num2
FROM Employees;
You can also do it as part of the merge by nesting the mergefield inside a calculation field
{=Round({MERGEFIELD Number1}/5,0)*5}
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #3  
Old 04-13-2023, 05:51 AM
vanishingpoint vanishingpoint is offline How to round a number merged from access to a word table Windows 11 How to round a number merged from access to a word table Office 2021
Novice
How to round a number merged from access to a word table
 
Join Date: Apr 2023
Posts: 3
vanishingpoint is on a distinguished road
Default

Quote:
Originally Posted by Guessed View Post
Word fields are not a great place to do mathematical calculations so I would prefer to address this via the SQL query (either in Word's merge or by creating the query in Access and then linking to that query in the Merge). For instance, this SQL works to round to nearest 5
Code:
SELECT [Last Name], [First Name], [Number1], [Number2], (Round([Number1]/5,0))*5 AS Num1, (Round([Number2]/5,0))*5 AS Num2
FROM Employees;
You can also do it as part of the merge by nesting the mergefield inside a calculation field
{=Round({MERGEFIELD Number1}/5,0)*5}
Awesome. Thanks.
Reply With Quote
Reply

Tags
maths, merge, syntax

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to round a number merged from access to a word table Bug in table with merged cells (word 2016) ch.b Word 2 09-12-2017 09:41 AM
How to round a number merged from access to a word table Text position in merged table cells - word 2010 ellentk Word Tables 3 09-09-2015 03:33 PM
How to round a number merged from access to a word table Round off the number ubns Word VBA 4 09-06-2012 03:55 PM
How to round a number merged from access to a word table Set range for merged Word table cells? tinfanide Word VBA 1 02-06-2012 05:57 AM
How do I reference a merged cell in a multi column & row table in MS Word ('03')? jihanemo Word Tables 0 03-18-2009 08:33 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:06 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft