Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
MarkTheNuke
 
Posts: n/a
Default Scientific notation

How do I display the results of a calculated field in scientific notation.
Is this possible. Thanks in advance.
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.word.mailmerge.fields
macropod
 
Posts: n/a
Default 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

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
how do i insert scientific notation johnmc Microsoft Word Help 3 April 22nd 23 06:32 AM
How to display exponential numbers or scientific notation? jmuirman Microsoft Word Help 1 November 30th 05 05:32 PM
scientific notation. quasi Microsoft Word Help 1 May 14th 05 09:11 AM
long scientific document Qreg Formatting Long Documents 11 April 19th 05 03:35 PM
How to write Scientific chemical formulas? Scott Microsoft Word Help 4 February 22nd 05 09:00 PM


All times are GMT +1. The time now is 11:27 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"