Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-16-2024, 04:34 AM
Andy.T Andy.T is offline Multiple calculations in a single line? Windows 11 Multiple calculations in a single line? Office 2021
Novice
Multiple calculations in a single line?
 
Join Date: Jul 2024
Posts: 5
Andy.T is on a distinguished road
Default Multiple calculations in a single line?

Hi there,



I've managed to do some simple maths e.g. Performing a single operation on a mail merge field, and adding two mail merge fields together.

I now need to add two fields together and then multiply that total by 1.2, to give a gross (post tax) total.

I've had a look at the Field Maths tutorial, but I'm still struggling to get my head around whether there's a syntax to get it to do what I want all at once.

Predictably, if I try...

{ ={ MERGEFIELD FIELD1}+{MERGEFIELD FIELD2} * 1.2}

...it of course only does the multiplication on FIELD2.

Is there a way of getting it to do everything I want in a single line? By positioning the brackets differently?

Or, as there are three operations, would I need to do something like use different variables to hold the results of FIELD1 * 1.2 and FIELD2 * 1.2 and then add those two variables together?

If so, could you give me a pointer on the code for that?

Changing the data at source would mean dev work, so if it's possible to do this within Word it would be much better.

Thanks,

Andy.T
Reply With Quote
  #2  
Old 07-16-2024, 04:51 AM
Italophile Italophile is offline Multiple calculations in a single line? Windows 11 Multiple calculations in a single line? Office 2021
Expert
 
Join Date: Mar 2022
Posts: 538
Italophile is just really niceItalophile is just really niceItalophile is just really niceItalophile is just really nice
Default

I haven't tried it but logically it should be:
{ =({ MERGEFIELD FIELD1}+{MERGEFIELD FIELD2}) * 1.2}
Reply With Quote
  #3  
Old 07-16-2024, 04:57 AM
Andy.T Andy.T is offline Multiple calculations in a single line? Windows 11 Multiple calculations in a single line? Office 2021
Novice
Multiple calculations in a single line?
 
Join Date: Jul 2024
Posts: 5
Andy.T is on a distinguished road
Default

Quote:
Originally Posted by Italophile View Post
I haven't tried it but logically it should be:
{ =({ MERGEFIELD FIELD1}+{MERGEFIELD FIELD2}) * 1.2}
Ahah! That works perfectly, that's brilliant, thanks so much.

I'm a complete novice so I was thinking the solution would involve more curly brackets, I hadn't thought one could use standard brackets.
Reply With Quote
  #4  
Old 07-16-2024, 05:24 AM
Italophile Italophile is offline Multiple calculations in a single line? Windows 11 Multiple calculations in a single line? Office 2021
Expert
 
Join Date: Mar 2022
Posts: 538
Italophile is just really niceItalophile is just really niceItalophile is just really niceItalophile is just really nice
Default

If you have another look at the Field Maths tutorial you will see several examples showing the use of brackets.
Reply With Quote
  #5  
Old 07-16-2024, 11:01 AM
Kevin Weaver Kevin Weaver is offline Multiple calculations in a single line? Windows 10 Multiple calculations in a single line? Office 2021
Novice
 
Join Date: Mar 2023
Posts: 2
Kevin Weaver is on a distinguished road
Default

This is simply using the parentheses to dictate the order of operations.
Reply With Quote
  #6  
Old 07-16-2024, 11:08 AM
Andy.T Andy.T is offline Multiple calculations in a single line? Windows 11 Multiple calculations in a single line? Office 2021
Novice
Multiple calculations in a single line?
 
Join Date: Jul 2024
Posts: 5
Andy.T is on a distinguished road
Default

Quote:
Originally Posted by Kevin Weaver View Post
This is simply using the parentheses to dictate the order of operations.
Yep, I didn't know one could use regular brackets, but Italophile set me straight, so I'm all set.

I'm completely new to this, never done anything like this before. Thanks for your reply.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to get single line spacing? abrogard Word 3 04-19-2022 04:39 AM
How to perform summary calculations in multiple worksheets, merged cell format and new product issue leeqiang Excel Programming 1 09-26-2020 11:14 PM
Multiple calculations in a single line? Need help with mind bending calculations taken from values in multiple places excerbated123 Excel 3 03-10-2015 07:11 AM
Multiple calculations in a single line? macro to add brackets to each line and add single quotes to each word in the line bracketandquotes Word VBA 17 02-16-2015 03:51 PM
Multiple calculations in a single line? Different alignments in a single line George99 Word 2 01-24-2010 05:49 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:15 AM.


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