Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Scientific notation
How do I display the results of a calculated field in scientific notation.
Is this possible. Thanks in advance. |
#2
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Scientific notation
There are no facilities in Word's numeric formatting switch to produce
results in scientific notation. You could probably produce a sequence of { IF } fields that would do it if you knew your exponents were going to fall within a reasonably small range, but otherwise, I think you need to find a way to use the Format function in VBA, which can do it - for example format(1234.5,"0.00E+00") returns 1.23E+03 { IF so the question is how to get VBA to process your number. That depends on what you're doing - if it's a one-off, it might be enough simply to create a VBA macro that formats the selected text. A possible approach is to nest your field inside a DATABASE field. If you're using Word 2003 and probably 2002, you should be able to do the following { DATABASE \d "C:\\a\\a.mdb" \s "SELECT format(1234.5,'0.00E+00')" } where a.mdb is valid Access .mdb file (it doesn't need to have any tables in it). If the field you want to format is, e.g. { =1234.5 } then nest it, e.g. { DATABASE \d "C:\\a\\a.mdb" \s "SELECT format({ =1234.5 },'0.00E+00')" } wher all the {} are the field braces you can insert using ctrl-F9 In theory, because you are only returning a single row and column, Word does not put the result in a table. But in Word 2003 I've noticed that the DATABASE field can insert an additional paragraph mark which may make this approach unusable. Peter Jamieson "MarkTheNuke" wrote in message ... How do I display the results of a calculated field in scientific notation. Is this possible. Thanks in advance. |
#3
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Scientific notation
Hi Mark,
The following compound field will return the scientific notation of any +ve value between 10^-9 and 10^9: {QUOTE {SET a {SourceVal}} {SET b{=9-(a10^9)-(a10^8)-(a10^7)-(a10^6)-(a10^5)-(a10^4)-(a10^3)-(a10^2) -(a10^1)-(a10^0)-(a10^-1)-(a10^-2)-(a10^-3)-(a10^-4)-(a10^-5)-(a10^- 6)-(a10^-7)-(a10^-8)}} {SET c{=int(a/10^b)+mod(a,10^b)/10^b}} {c \# 0.00}E{b \# +00;-00}} where 'SourceVal' is the input, which could be a formula taking its input from two formfields. You can extend the range easily enough by adding more terms. All the field braces (i.e. { }) are created in pairs via Ctrl-F9. I've laid the coding out with line breaks to separate the key portions of the coding, but you don't really need them. Cheers "MarkTheNuke" wrote in message ... How do I display the results of a calculated field in scientific notation. Is this possible. Thanks in advance. |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
how do i insert scientific notation | Microsoft Word Help | |||
How to display exponential numbers or scientific notation? | Microsoft Word Help | |||
scientific notation. | Microsoft Word Help | |||
long scientific document | Formatting Long Documents | |||
How to write Scientific chemical formulas? | Microsoft Word Help |