Tom,
The first formula did it !
I'm ashamed when ik look at mine (very) complicated formula (that had to
consider the presence of a "." or a"," ...) and that did also the job !
( but as they say: "Many roads lead to Rome")
Finalnumber=
Substitute(Case(Left( GetAsText(GetAsNumber(NUMBER)) ;1)="," and
Length(NUMBERTEKST)=2;"0"&Substitute(GetAsNumber(NUMBER);",";".")&"0";
Left( GetAsText(GetAsNumber(NUMBER)) ; 1)="," and
Length(NUMBERTEKST)>2;"0" & GetAsNumber(NUMBER);
Case(Position(GetAsText(Round(NUMBER;2)); "," ; 0 ;1 )=0 ;
GetAsNumber(NUMBER)& ".00" ; Left( Right( GetAsText(GetAsNumber(NUMBER))
; 2 ) ;
1)=",";GetAsNumber(NUMBER)&"0";Position(GetAsText(Round(NUMBER;2)); "."
; 0 ;1 )=1; "0"&GetAsNumber(NUMBER);Replace(GetAsNumber(NUMBER);
Position(GetAsNumber(NUMBER); "," ; 0 ;1 ) ; 1 ; "." )));",";".")
On 24/10/2014 23:37, Tom Elliott wrote:
Eric
If you're only needing this for export then you could possibly use the export
option 'Apply current layout's data formatting to exported data'
However if you want the number stored with exactly 2 decimal places, you could
use the following as the auto-enter calculation for the field with 'Do not
replace existing value (if any)' unchecked:
If ( Self < 0 ; "-" ) & Div ( Abs ( Self ) ; 1 ) & "." & Right ( "00" & Round
( 100 * Mod ( Abs ( Self ) ; 1 ) ; 0 ) ; 2 )
or, if you prefer;
Let ([
sign = If ( Self < 0 ; "-" ) ;
i = Div ( Abs ( Self ) ; 1 ) ;
d2 = Round ( 100 * Mod ( Abs ( Self ) ; 1 ) ; 0 )
] ;
sign & i & "." & Right ( "00" & d2 ; 2 )
)
cheers
Tom Elliott
On 24 Oct 2014, at 21:01, Eric Van Deputte wrote:
On 24/10/2014 21:58, Richard S. Russell wrote:
On 2014 Oct 24, at 14:47, Eric Van Deputte <[email protected]> wrote:
Hi everyone,
I'm in the urgent need of a formula that gives me always a numberfieldresult with no more
and no less than 2 decimals ( "xxxxx.00" ) ....
The data from which the result has to be to calculate can be something like:
0.01
0.10
0.1
.01
16.01
11
111.00
an are first rounded to 2 decimals
Do you need them to be STORED that way or only DISPLAYED that way? Because
displaying is easy. You can do it under the “Data Formatting” section of the
“Data” tab under the inspector:
To be stored to be exported ...
--
mvg
--------
Dr. Eric Van Deputte dvm
--
mvg
--------
Dr. Eric Van Deputte dvm
1750 Lennik
[email protected]
www.vwin.be
phone +32(0)2 523 32 95
gsm: +32(0)475 34 80 36
fax +32(0)70429537
---
Dit e-mailbericht bevat geen virussen en malware omdat avast!
Antivirus-bescherming actief is.
http://www.avast.com