Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-07-2014, 08:08 PM
macropod's Avatar
macropod macropod is offline Tables withmergefields, if statement and calculations. Windows 7 64bit Tables withmergefields, if statement and calculations. Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,521
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Word fields can't really do any meaningful string testing for parts of a string and are even more limited for string splitting. That said, it would be possible to test whether the field ends with 5%, for example, and vary where the whole of the output for that field goes, accordingly.

So, if your field outputs '£84.00 + VAT @ 20%', or '£84.00 + VAT @ 5%', you could use two fields, to conditionally output the whole field in either column:
{IF{MERGEFIELD Amount}= "*20%" {MERGEFIELD Amount}}


{IF{MERGEFIELD Amount}= "*5%" {MERGEFIELD Amount}}
or:
{IF«Amount»= "*20%" «Amount}}
{IF«Amount»= "*5%" «Amount}}
where 'Amount' is your mergefield's name

Splitting the output components is more complicated, involving some circumlocution. The following will return the £ values:
{IF{MERGEFIELD Amount}= "*20%" {={MERGEFIELD Amount}-.2 \# "£,0.00"}}
{IF{MERGEFIELD Amount}= "*5%" {={MERGEFIELD Amount}-.05 \# "£,0.00"}}
or:
{IF«Amount»= "*20%" {=«Amount»-.2 \# "£,0.00"}}
{IF«Amount»= "*5%" «Amount»-.05 \# "£,0.00"}}
The following will return the % portions:
{IF{MERGEFIELD Amount}= "*20%" "+ VAT @ 20%"}
{IF{MERGEFIELD Amount}= "*5%" "+ VAT @ 5%"}
or:
{IF«Amount»= "*20%" "+ VAT @ 20%"}
{IF«Amount»= "*5%" "+ VAT @ 5%"}

Note: The field brace pairs (i.e. '{ }') for the above examples are all created in the document itself, via Ctrl-F9 (Cmd-F9 on a Mac); you can't simply type them or copy & paste them from this message. Nor is it practicable to add them via any of the standard Word dialogues. Likewise, you can't type or copy & paste the chevrons (i.e. '« »') - they're part of the actual mergefields, which you can insert from the mailmerge toolbar. The spaces represented in the field constructions are all required.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #2  
Old 10-14-2014, 01:45 AM
Mulith Mulith is offline Tables withmergefields, if statement and calculations. Windows 7 32bit Tables withmergefields, if statement and calculations. Office 2010 32bit
Novice
Tables withmergefields, if statement and calculations.
 
Join Date: Oct 2014
Posts: 15
Mulith is on a distinguished road
Default Prefect!

Perfect that has resolved the problem. Thanks for your help.
Reply With Quote
Reply

Tags
mergefields, ms word, tables



Similar Threads
Thread Thread Starter Forum Replies Last Post
Tables withmergefields, if statement and calculations. Tiered Fee Calculations lynchbro Excel 5 07-17-2014 11:01 AM
Tables withmergefields, if statement and calculations. Table Calculations, VBA SuzeG Word VBA 7 12-15-2013 07:12 PM
How to do Calculations In a Text Box? SteveF Word 4 09-27-2013 08:34 AM
Tables withmergefields, if statement and calculations. Using Reference Tables in calculations BritBiker2 Excel 5 02-15-2013 04:19 AM
Tables withmergefields, if statement and calculations. Can I do calculations with times? cubsfan_1 Excel 1 01-14-2010 06:55 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:38 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