#1
|
|||
|
|||
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? |
#2
|
||||
|
||||
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] |
#3
|
|||
|
|||
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) |
#4
|
||||
|
||||
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] |
#5
|
|||
|
|||
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 % |
#6
|
||||
|
||||
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] |
#7
|
|||
|
|||
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 |
Tags |
fieldmerge percent ifelse |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
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 |
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 |
Installation Source Corrupted | browneyes | Office | 1 | 01-23-2006 02:33 PM |