473,321 Members | 1,877 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

Round the number 1.3 to 2

35
hello everybody,
my requirement is,i want to show some links in my page.
and the no. of links to be shown depends on the recordcount of the table.

no_of_links=round(rs.recordcount/1000)
if no_of_links=1.5 or so..it rounds upto 2
but if it is in less than 1.5 like 1.3 ,it is truncated to 1 ofcourse,then only 1 link is shown on the page instead of 2.here is the problem

if u can suggest some user defined function..or any other soln..plz reply ASAP
regards, :)
Lipsa
Aug 9 '06 #1
5 1868
hi lipsa,

Try mod function ya

no_of_links=round(rs.recordcount mod 1000,2)


it will work if any please msg again......
Aug 9 '06 #2
lipsa
35
hey its not working,giving weird result..
rs.recordcount =142
total_recd_dis=60
then
no_of_links=round(rs.recordcount mod clng(total_recd_dis),2)
gives 22 !!!!!!!!!!
where as i need a result no_of_links=3
Aug 9 '06 #3
hi lipsa,

This code is ok for u? if 2.37 means its display only 2 above 2.50 then display 3 ok...

<%
rs =152
total_recd_dis=60

a=(rs / total_recd_dis)
Response.Write(Round(a,2))
%>
Out put : 3
--------


<%
rs =142
total_recd_dis=60

a=(rs / total_recd_dis)
Response.Write(Round(a,2))
%>
Out put : 2


Send reply
Aug 9 '06 #4
lipsa
35
hi,
see 152/60=2.53333 so round(2.53333) willl giv 3 definitely
BUT
142/60=2.36666 so round(2.3666) will giv 2.here i want 3.
i m thinking of doing using mid/substr function
i will check number(x) after decimal(here 3666)
if x>0 then i will add 1 to the no before decimal...
so 2+1= 3....
if x=0 then
2 will be 2
let me try...wat say???
Aug 9 '06 #5
Ji lipsa,

see here use Int founction and add +1 for every time so ur problem is sloved na?
<%
rs =342
total_recd_dis=60

a=(rs / total_recd_dis)
Response.Write(Round(a,2))

Record=(int(a))
Re=Record + 1
Response.Write("<p>" &Re)
Response.Write("<p>" &(Int(a)))

%>

Reply if any problem?
Aug 9 '06 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: yulyos | last post by:
Hi, Round Number Function You can download a small example: Watch and copy examples of Source Code in VB.NET yulyos4vbnet@yahoo.com http://www.geocities.com/yulyos4vbnet Have a nice day
6
by: Penguin | last post by:
At some long ago time Steve Jorgensen answered thus: Subject: Re: How can I round a time? Newsgroups: comp.databases.ms-access Date: 1998/12/11 Access represents a date internally as a double...
2
by: Marcos Jose Setim | last post by:
Hello, I need to round one number in language C, but I did not obtain. I already tried to use the: #include <math.h> ceil(value); But it's shown one error:
4
by: Fuzzydave | last post by:
I have been using a round command in a few places to round a value to zero decimal places using the following format, round('+value+', 0) but this consistantly returns the rounded result of...
5
by: ibiza | last post by:
Hi all, I'd need a function that would rounds values like : d = roundTo(64.2, 0.25) ' returns 64.25 d = roundTo(64.2, 10) ' returns 64 d = roundTo(64.2, 100) ' returns 100 well, that rounds...
6
by: dkirkdrei | last post by:
I am looking for a way to round a number (which will be displayed as a dollar amount) to the nearest nickel. Using the php round function only allows you to control the number of decimal places in...
1
by: dhutton | last post by:
Hello - Question... What would be the best way to round a number off and change it to currency with the below statement? SELECT Cycle AS BillCycle, SUM(PrevBillAmt) - SUM(Payment) +...
19
by: muddasirmunir | last post by:
can any body tell me how to round numbers in in exactly two decimal places i had use a function round(text1.text,2) but whenever there is zere(0) at the end it does not show it for eg for round...
0
by: Edwin.Madari | last post by:
>>round(76.1, -2) 100.0 80.0 76.0 builtin function round, will work for you...... Help on built-in function round in module __builtin__: round(...) round(number) -floating point number
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.