sjuul Posted February 7, 2008 Posted February 7, 2008 Hallo, Ik probeer een calculatie te maken, welke uit mijn prijsveld (met vijf decimalen) de centjes achter de comma losmaakt, en afrond naar boven. waarde in mijn prijsveld: 19,94587 gewenste uitkomst: ,95 Mijn hack so-far: Let ( $prijs = GetAsText ( Prijs in ) ; Round ( Right ( $prijs ; Position ( $prijs ; "," ; 1 ; 1 ) ) ; 2 ) ) Wie leid mij op weg? Quote
0 Koen Van Hulle Posted February 7, 2008 Posted February 7, 2008 Round zal enkel afronden en je wil eigenlijk altijd naar boven afronden. Daarvoor hebben ze de Ceiling functie geintroduceerd. Let ( [ theValue = Prijs In // 19,94587 ; theValue = theValue - Floor(theValue) // 19,94587 - 19 = 0,94587 ; theValue = theValue * 100 // 94,587 ; theValue = Ceiling(theValue) // 95 ; theValue = theValue/100 // 0,95 ] ; theValue ) Of iets korter uitgeschreven: Let ( [ theValue = Prijs In ] ; Ceiling (( theValue - Floor(theValue) ) * 100) / 100 ) waarde in prijsveld: 19,94587 uitkomst: ,95 waarde in prijsveld: 19,941234 uitkomst: ,95 waarde in prijsveld: 19,94 uitkomst: ,94 Quote
0 JeanWM Posted February 16, 2008 Posted February 16, 2008 gewenste uitkomst: ,95 round ( mod (getal ; 1 ) ; 2 ) Resultaat: 0,95 Quote
Question
sjuul
Hallo,
Ik probeer een calculatie te maken, welke uit mijn prijsveld (met vijf decimalen) de centjes achter de comma losmaakt, en afrond naar boven.
waarde in mijn prijsveld: 19,94587
gewenste uitkomst: ,95
Mijn hack so-far:
Wie leid mij op weg?
3 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.