Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-26-2012, 12:24 AM
legg1 legg1 is offline Mergefield IF/ELSE determin source type Windows 7 64bit Mergefield IF/ELSE determin source type Office 2010 32bit
Novice
Mergefield IF/ELSE determin source type
 
Join Date: Mar 2012
Posts: 4
legg1 is on a distinguished road
Angry Mergefield IF/ELSE determin source type

Hello all,

I was just wondering if there's some obvious way i've missed, to determin the input type, in this case with decimals.

I only know PHP, so this is a bit new, but , it should be something like this:

IF fieldname > 1 THEN show fieldname
ELSE
IF fieldname < 1 AND decimalcount > 1 THEN show fieldname*100 \# 0%



Anyone able to help?
Reply With Quote
  #2  
Old 03-26-2012, 08:48 PM
macropod's Avatar
macropod macropod is offline Mergefield IF/ELSE determin source type Windows 7 64bit Mergefield IF/ELSE determin source type Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
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

Hi legg1,

What is/are the field names? Are all the data numeric? What are you trying to achieve (ie result, not method)?
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 03-26-2012, 09:03 PM
legg1 legg1 is offline Mergefield IF/ELSE determin source type Windows 7 64bit Mergefield IF/ELSE determin source type Office 2010 32bit
Novice
Mergefield IF/ELSE determin source type
 
Join Date: Mar 2012
Posts: 4
legg1 is on a distinguished road
Default

The fieldname is vekttall, and it is always numeric.
What i am trying to achieve is to put a % behind the number, if it is less than 1 in value, containing more than 1 decimal (round it to 2 decimals)
Reply With Quote
  #4  
Old 03-26-2012, 09:07 PM
macropod's Avatar
macropod macropod is offline Mergefield IF/ELSE determin source type Windows 7 64bit Mergefield IF/ELSE determin source type Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
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

Hi legg,

Unless you want values => 1 formatted differently, I don't see where the "less than 1 in value" comes into play.

To control percentage formatting in Word, add a formula and numeric picture switch to the mergefield, as follows:
• select your mergefield, which will look like «vekttall»;
• press Ctrl-F9 to wrap another field around it, thus { «vekttall» };
• edit the field so that you get {=«vekttall»*100 \# 0.00%}. This will force all the data to show as percentages, to two decimal places;
• position the cursor anywhere in this field and press F9 to update it;
• run your mailmerge.

Note: the precision of the displayed value is controlled by the '0.00'. You can use anything from '0' to '0.000000000000000'.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 03-26-2012, 09:10 PM
legg1 legg1 is offline Mergefield IF/ELSE determin source type Windows 7 64bit Mergefield IF/ELSE determin source type Office 2010 32bit
Novice
Mergefield IF/ELSE determin source type
 
Join Date: Mar 2012
Posts: 4
legg1 is on a distinguished road
Default

This i have working, problem is when the number is NOT percentage

The same field switches between percentage, and full number.

Everything listed as 0.xx is percentage, and everything above 1 (can be from 1 til 10 000 000) should be without the %
Reply With Quote
  #6  
Old 03-26-2012, 09:16 PM
macropod's Avatar
macropod macropod is offline Mergefield IF/ELSE determin source type Windows 7 64bit Mergefield IF/ELSE determin source type Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
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

Hi legg,

You really shouldn't have different data types in the same fields. Nevertheless, you can use field coding to work around it:
{IF«vekttall» < 1 {=«vekttall»*100 \# 0.00%} {=«vekttall» \# 0}}
or:
{IF«vekttall» < 1 {=«vekttall»*100 \# 0.00%} {MERGEFIELD vekttall \# 0}}

Note: The field brace pairs (ie '{ }') for the above examples are created via Ctrl-F9 - you can't simply type them or copy & paste them from this message. Likewise, you can't type or copy & paste the chevrons (ie '« »') - they're part of the actual mergefields, which you can insert from the mailmerge toolbar.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #7  
Old 03-26-2012, 09:18 PM
legg1 legg1 is offline Mergefield IF/ELSE determin source type Windows 7 64bit Mergefield IF/ELSE determin source type Office 2010 32bit
Novice
Mergefield IF/ELSE determin source type
 
Join Date: Mar 2012
Posts: 4
legg1 is on a distinguished road
Default

Unfortunately it is not my documents, it's a clients mailmerge, and just trying to find a solution for him, as he's got these two datatypes in the one.

Thanks alot though! Will try
Reply With Quote
Reply

Tags
fieldmerge percent ifelse



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mergefield IF/ELSE determin source type IF statement just generates text "MERGEFIELD" in document - what am I doing wrong? Eri Mail Merge 1 03-03-2012 03:03 PM
Mail Merge to multiple .doc files named after a mergefield nicnad Mail Merge 1 02-22-2012 01:59 AM
Mergefield IF/ELSE determin source type Mail Merge to print specific record based on mergefield criterias nicnad Mail Merge 1 02-22-2012 01:53 AM
Mergefield date error michielvanderbiest Mail Merge 1 04-12-2010 11:22 PM
Mergefield IF/ELSE determin source type Installation Source Corrupted browneyes Office 1 01-23-2006 02:33 PM

Other Forums: Access Forums

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