Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-07-2014, 07:52 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 Tables withmergefields, if statement and calculations.

Hi,



I am currently working with a table in Word which forms part of invoice.

The invoice makes use of a table within word and pulls data into Word using merge fields. At this point in time it uses merge fields to pull in the description of a fee and the date of the transaction in column a and the gross amount of the fee in column C.

What I'd like to do is split off the VAT element into column B.

As VAT is not always 20% I need to search the value within the description merge field in column A for the VAT amount to be applied:

Example of fee description:
05 Jun 2014 - 60% Take On Fee (£84.00 + VAT @ 20%)


What I'd like to do is add an if statement in column B which checks the description for "+ VAT @ 20%" if it finds this value then to take the value from column C and get the VAT component as the value in column B.

Else if the "+VAT @ 5%" then split off 5% VAT into column B

Else add 0.00 as value within column B.

If this could be achieved it would be an absolute life saver. Any help would be greatly appreciated.
Reply With Quote
  #2  
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: 21,963
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
  #3  
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:35 PM.


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