Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

get the last 3 digits in a number

Status
Not open for further replies.

Devaki

Programmer
May 23, 2001
58
US
Hi ,
I have a number 1.250356. I want to take only 0356 out of it. If i use mid and convert it to text it brings out a blank result
MOVEHISTORY.CYCLETIME=1.250356
For example
mid(totext({MOVEHISTORY.CYCLETIME}),5)

Is there a way to get this number 0356?

Thanks
Devaki
 
Use a bit more control on ToText and use
Mid(ToText({MOVEHISTORY.CYCLETIME},"000.000000"),7)

ToText by default only displays two decimals.
If your number could be greater than 100 then you might need some more leading zeros in the mask, and a number bigger than 7. Editor and Publisher of Crystal Clear
 
Hi ,

I used the formula
ToText({MOVEHISTORY.CYCLETIME},"0.000000")

but the number is getting rounded. For example 0.256932 is rounded as 0.26 but i want to take it as .006932

How do i get this?

Thanks for your help
Devaki
 
Hi ,

I made a mistake in the formula
ToText({MOVEHISTORY.CYCLETIME},7) works fine

Thanks
Devaki
 
Provided that you will always have six decimal places, use this formula:

(({fieldname}*100)-Truncate({fieldname}*100))/100

in plain math:
((.256932*100)-truncate(.256932*100))/100=
((25.6932)-25)/100=
.6932/100=
.006932 Software Support for Sage Mas90, Macola, Crystal Reports, Goldmine and MS Office
 
Thanks gillz This is exactly what i want to do

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top