Rounding Off To 2 Decimal Places
can anyone help me i want to round off a number entered by a user to two decimal points for a number of text boxes.
View Repliescan anyone help me i want to round off a number entered by a user to two decimal points for a number of text boxes.
View RepliesI have got the total amount of hours flown in the top left hand side of the home page and it is in hours.
Trouble is the decimal places need to be rounded to 2 as sometimes it says sometihg like 3254.63333333333 hours. I'd like it to say something like 3254.63 instead.. Code:
Right now I round my number to 2 decimal places... and since I am dealing with money values I need to show $100.70...but my calculations show $100.7. Is there a way to fix this? How can I tack on a "0" if it only shows 1 decimal place?
View Replies View RelatedI have searched the forum and found the answer to my problem but unfortunitly it didn't tell me how to implement the solution!
The code I have thanks to previous forums:
Code:
<%=(rs("Seconds")/60=FormatNumber(2.5,2))%>
Basiclly I want to convert the seconds to minutes and round to two decimal places.
I need to truncate a number to two decimal places without rounding. All the functions i;ve tried tend to round up the numbers. Also i cant use any string functions to limit the size because the size can vary. example, 34.56998 must be set to 34.56 .
View Replies View Relatedcan anyone tell me the easiest way to make sure numbers get passed with 2
decimal places?
ie:
<select name="TagCost" id="TagCost">
<option value="25.00">1 @ 25.00</option>
<option value="50.00">2 @ 25.00</option>
</select>
fprice=request("TagCost") <------- need to make sure this is 25.00 not 25
I am trying to display a currency field from an access db on an ASP
page. The only problem i found is that if there is a 0 (zero) after
the decimal i.e. 79.60 it is not displayed.
I tried doing the whole var = CCur(TBL("Price")) thing but there is no
zero.
I have some code that divides a number and then prints this number. It performs a cost rollup basically and then adds a percentage. The code works fine except that the number returned has many figures afert the decimal point (as you would expect really) How can I remove these ? I am not really concerned about rounding up or down, just removing to give me a whole number.
View Replies View RelatedWhere in the following line of code would i place format percent so that the output is like this
6% (no decimal places just a number and a % sign.
<%
If (lngVotesCast>0) Then
%>
<%=CLng(objRs1("num"))/lngVotesCast%>
<%Else%>
<%End If%>
I have tried it in various places but i can't get it to work
how do i round off a number to 2 decimal places? This code taken from www.w3schools.com only round the number to a whole number.
<html>
<body>
<script type="text/vbscript">
i = 48.66776677
j = 48.999
document.write(Round(i))
document.write("<br />")
document.write(Round(j))
</script>
</body>
</html>
I have a report that will format a number to the last 2 decimal places. However it will trim off the 0 at the end. Example.
98.90 is formated to 98.9
how can i tell the format number function to not trim the 0 but still have the last 2 digits.
i create virtual directory on iis with network directory is a share located on another computer...after i did that ....i can't browse that virtual directory...if i browse that virtual directory ...at browser IE show message the page cannot be found
View Replies View RelatedAlright, I have a form that needs to post to form_process.asp
However, it also needs to post to another site/, say example.com/process.asp
How would I do this?
The place it needs to post to is off site, and MY form_process.asp needs to save the data before submitting it to example.com/process.asp
Possible?
I need to round off a few fields to 1 or 2 decimal places but if the number is negative, it gives -0.0 or -0.00 after rounding off. Eg. -0.001356 after rounding off to two decimal places gives me -0.00...which is meaningless as -0.00 is useless Also, -0.019 should give -0.02.Tried using FormatNumber and Round functions in VBScript but still it gives the same results.
View Replies View RelatedI have a page in witch 4 or so variables are loaded from a database. They are of currency format and then they are add up to get a total. Problem is that say the total is $6.10 the actual return is rounded down to $ 6.1 . How can I get it to show $6.10 , less rounding ??
View Replies View RelatedThis is my souce code to upload multiple file into 1 directory. How can i improve it to make it can upload to 2 different place in the same time when i click the upload button? Code:
View Replies View RelatedI'm not very familiar with classic ASP, but I need to modify an existing form on an ASP site to make the form data get posted to 2 different locations. Any suggestions on options to accomplish this?
View Replies View Relatedi have a very simple question which is driving me nuts. Using the ASP function Round():
Why do BOTH Round(1.775, 2) and Round(1.785, 2) both give the exact same result of 1.78 ?
Surely they should give different results, 1.78 and 1.79 respectively.
I'm using asp, obviously, and mysql. My prices are using the decimal field type... what can I do to make it round up the the nearest 5?
View Replies View RelatedI've got this script, and its been giving me this result as seen below. 2 questions I would like to ask..
1. How would I modify the below script in order to round the numbers?. (Script further down.)
2.You see the output result where it says 3268.19?, the white space next to it means the 'Parts' record set is blank but did have a weight value, now how would I substitute the word "NA" for the white space being shown? .....
I'm trying to work out how I can round off a number that the user inputs. I need the number to round up to the nearest 50. For example, if the user enters 234, I want it to round up to 250. If the user enters 51, I want it to round up to 100. Has anyone got any suggestions for coding?
View Replies View RelatedI am working on a shipping calculator, and basically need to round up a number to the nearest 1 and am unsure how to go about it, any ideas?
View Replies View RelatedIf CInt(StrFirst) rounds up the value what rounds down the number i.e just show the whole number with out taking in to account anything after the decimal point?
View Replies View RelatedI'm trying to calculate two time fields. And when the result is smaller then 15 min, it has to round it to 15 min. Example:
begin time: 14:00
end time: 14:40
(end time - begin time = 40 minutes)
result has to be: 45 minutes
The result wil be shown in a form field. This is the code I'm using (it works fine in my database), perhaps I have to adjust it for asp? But I don't know how. Code:
I'm doing up a stats page for a survey, and this is a small
part of one of the results. Below is part of the code to do
totals/percents. My question is, how do i make it so myAnswer is
written with two decimal places?
Currently, it displays the percent as 4.76190476190476
<%
myAnswer = OneAgree_total / OneTotal_total * 100
Response.Write "" & myAnswer
%>
if i have a value of 11.7908787541713
how could i trim it to 11.79 and how do i round the number up?
Is there a way to round a number that is calculated in an sql statement?
1/25/2006 NT NT 10 NT
1/26/2006 450000 NT 10 NT
1/26/2006 200100 5 NT 5
1/26/2006 50000 5 NT 5
Average 233366.6667 5 10 5
On my average row, i dont want any numbers after the decimal point. My sql is Select AVG(XXX) from `test` Where `XXX` <> -1
I had recently found a function that will write out a currency amount in words. It worked fine until I passed it a variable retreived from the stored procedure.
Well I had to change an "Int()" to "CDbl()" within the function because I got an error: "Variable uses an Automation type not supported in VBScript". I also changed an "(Abs(nAmount)" to an "(Abs(CDbl(nAmount))" because of the same error. Code:
if there is an easy way to convert hex to decimal with asp, the hex() function is there to get the decimal to hex, but i haven't been able to find a way to go back.
View Replies View RelatedI want to convert a number to percentage or decimal,is there any built-in function for this?
View Replies View Relatedi want to do the calculation like
value=int(basic) * int(excise) / 100
the both value come from the form. so when the data of excise field is like decimal 16.32 then i get the error data type mismatch.because the excise is 16.32 it is a decimal value. i have used CDbl(excise) but still it gives error.
My ASP driven site has always used MySQL as the DB backbone, mainly as the hosting costs of MySQL are far cheaper than SQL Server at the mo, and it has worked fine until my ISP thought that they were doing everybody a favour by upgrading to v5 from v4.
What happens now is that any ASP query that I do that involves any of my MySQL Decimal data type fields goes belly up. It will not work. Looks to be an issue with ASP, MyODBC and MySQL, but I just wanted to check if there was a better/more reliable data type than Decimal (which obviously performs the same numerical functions) and if there was a quick way to convert all of my Decimal fields to this new type.
Testing a ASP page using an Access db and I have a field in the DB defined as a 'number' with a precision of 3. Upon submitting the test data, I get this error message.
Microsoft JET Database Engineerror '80040e21'Scaling of decimal value resulted in data truncation. Can anyone tell me what's going on? The test value I used was "2.5".