Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How can I crop a very large number?
#1
Solved: 11 Years, 3 Months, 4 Weeks ago
I'm kind of a newbie with QTP; can do most basic stuff. I have a very large number I need to crop, and cannot find anything in the books I have about cropping the number. The number is $2,459.000.168, and I just need it to be $2,459.00

Any help would be greatly appreciated!

Thx!
Reply
#2
Solved: 11 Years, 3 Months, 4 Weeks ago
Hi..

You can use Round() to get u r required Result..

Ex :
val = 2,459.000.168
val = Round(2,459.000.168, 2) -- now val contains 2,459.00
val = Round(2,459.000.168, 3) -- now val contains 2,459.000

Thx..
Reply
#3
Solved: 11 Years, 3 Months, 4 Weeks ago
Hi
val = 2459000.16866
val = Round(2459000.16866, 2) -- now val contains 2,459,000.17
val = Round(2459000.16866, 3) -- now val contains 2,459,000.168
ALSO
val = 2459000.16866
val = FormatNumber(2459000.16866, 2) '-- now val contains 2,459,000.17
val = FormatNumber(2459000.16866, 3) '-- now val contains 2,459,000.168
will give same result

Nandu, Round(2,459.000.168, 2) -> You can't pass arguments like this, will get error i guess.
Reply
#4
Solved: 11 Years, 3 Months, 4 Weeks ago
Thank you so much for your reply! I figured out why I got such a strange number. I extracted it from a web table with multiple columns. The first column contained the cost $2,459.00; the second column contained a rate of 0.168

Any way I can extract only the number from the first column? Here's what I used to extract:
Code:
string1=Instr(1,prem1,"Minimum Premium",1)
string2=Mid(prem1,string1)
string3=Replace(string2,"Minimum"," ",1)
str_1=Instr(2,Trim(string3),"$",1)
CroppedPrem=Trim(Left(string3,str_1))


Again, I so appreciate your reply!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Count the number of 3 number appers between 0-3333 SaranKumarV 1 3,780 09-20-2010, 06:32 PM
Last Post: rdemers25

Forum Jump:


Users browsing this thread: 2 Guest(s)