Result of equation

  • Thread starter Thread starter mo
  • Start date Start date
M

mo

I need to perform the following equation on a couple of values in a
database:

TSHMoMs = [TSH] / 10 ^ (0.5 +(0.12 * [GestAtSamp]))

TSH and GestAtSamp are fields in one of the tables. The equation works (I
think) except that Access is storing the values in a strnge way, like this:

1.22805866183807E-11
1.22859742033194E-11
1.22888981329413E-11
1.23549674777421E-11
1.23622595619083E-11
1.23676829773763E-11
1.24000591121663E-11
1.24547793363719E-11

Is there a way to get the formula to return a single, say rounded to two
decimals?

Thanks for any help.
 
If you have Access 2000 or newer, you could use the built in Round function.

TSHMoMs = Round([TSH] / 10 ^ (0.5 +(0.12 * [GestAtSamp])), 2)

This function does "scientific" or "banker's" rounding. At 1/2 it will round
to the nearest even number instead of rounding up. If you prefer 1/2 to
always round up try:

TSHMoMs = Int(([TSH] / 10 ^ (0.5 +(0.12 * [GestAtSamp]))) * 100 + 0.5) /
100

If negative numbers are possible, you may prefer to use Fix instead of Int.
Fix and Int will return the same result for positive numbers.
Int(-1.3) gives -2
Fix(-1.3) give -1
 
mo said:
I need to perform the following equation on a couple of values in a
database:

TSHMoMs = [TSH] / 10 ^ (0.5 +(0.12 * [GestAtSamp]))

TSH and GestAtSamp are fields in one of the tables. The equation works (I
think) except that Access is storing the values in a strnge way, like this:

1.22805866183807E-11
1.22859742033194E-11
1.22888981329413E-11
1.23549674777421E-11
1.23622595619083E-11
1.23676829773763E-11
1.24000591121663E-11
1.24547793363719E-11

Is there a way to get the formula to return a single, say rounded to two
decimals?

The number are stored as calculated, what you don't like is
the way they are presented to you. If they were to be
displayed without using scientific notation they would be:

.0000000000122805866183807
.0000000000122859742033194
. . .

Those numbers are so small as to be effectivly zero, so if
you rounded to two digits, all you'd get is .00
 
Hi Mo,

In the table's design view you can choose that column and set the decimal
places to '2'.
 
Whoops, what Wayne said.

--
Karen
Karen said:
Hi Mo,

In the table's design view you can choose that column and set the decimal
places to '2'.

--
Karen

mo said:
I need to perform the following equation on a couple of values in a
database:

TSHMoMs = [TSH] / 10 ^ (0.5 +(0.12 * [GestAtSamp]))

TSH and GestAtSamp are fields in one of the tables. The equation works (I
think) except that Access is storing the values in a strnge way, like this:

1.22805866183807E-11
1.22859742033194E-11
1.22888981329413E-11
1.23549674777421E-11
1.23622595619083E-11
1.23676829773763E-11
1.24000591121663E-11
1.24547793363719E-11

Is there a way to get the formula to return a single, say rounded to two
decimals?

Thanks for any help.
 
Back
Top