Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / August 2005

Tip: Looking for answers? Try searching our database.

Rounding to the nearest .5

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jeffshex - 18 Jul 2005 15:39 GMT
Does anyone know how to do this?  I've tried adjusting the decimal place to
1, but that didn't auto round or anything.  I have about 9 textboxes that
need to do this.
Any Ideas?
Alex [MSFT] - 19 Jul 2005 00:21 GMT
You can use rules to achieve this goal. Play with the "floor", "ceiling" and
"mod" XPath functions, they should help.

> Does anyone know how to do this?  I've tried adjusting the decimal place
> to
> 1, but that didn't auto round or anything.  I have about 9 textboxes that
> need to do this.
> Any Ideas?
Jeffshex - 19 Jul 2005 14:04 GMT
Well, i see the "round" function, but I need it to go by the nearst .5
Also, I did not see a mod function.  
Is this still possible?

> You can use rules to achieve this goal. Play with the "floor", "ceiling" and
> "mod" XPath functions, they should help.
[quoted text clipped - 4 lines]
> > need to do this.
> > Any Ideas?
Greg Collins [InfoPath MVP] - 19 Jul 2005 22:34 GMT
Do you mean to the "nearest" .5 or to the "next" .5? For example, if you have 123.6, does that mean you want 123.5 or 124.0?

The above is more for curiosity than anything.

My recommendation would be that you don't use rules, but instead use code. I'm sure if there's a good mathematician here, they could give you some kind of a formula to do this, but it seems to me that writing code is just as easy. Then you have fine-grain control over such neuances as I mentioned above.

Signature

Greg Collins [InfoPath MVP]
Please visit: http://www.InfoPathDev.com

Well, i see the "round" function, but I need it to go by the nearst .5
Also, I did not see a mod function.  
Is this still possible?

"Alex [MSFT]" wrote:

> You can use rules to achieve this goal. Play with the "floor", "ceiling" and
> "mod" XPath functions, they should help.
[quoted text clipped - 4 lines]
> > need to do this.
> > Any Ideas?
Jeffshex - 20 Jul 2005 13:56 GMT
I guess I would want it to go to the nearest .5
That would probably work the best for me.

> Do you mean to the "nearest" .5 or to the "next" .5? For example, if you have 123.6, does that mean you want 123.5 or 124.0?
>
[quoted text clipped - 16 lines]
> > > need to do this.
> > > Any Ideas?
Databasic - 05 Aug 2005 11:05 GMT
Dim oldno as Decimal = 23
Dim newno = int(oldno.Round((oldno /10 * 2),0) /2 * 10)
Response.write(newno)

> *Does anyone know how to do this?  I've tried adjusting the decimal
> place to
> 1, but that didn't auto round or anything.  I have about 9 textboxes
> that
> need to do this.
> Any Ideas? *

--
Databasic

Databasic - 05 Aug 2005 11:09 GMT
Oops sorry I misread. This rounds to the nearest 5 not .5

> *Dim oldno as Decimal = 23
> Dim newno = int(oldno.Round((oldno /10 * 2),0) /2 * 10)
> Response.write(newno) *

--
Databasic

Jeffshex - 05 Aug 2005 17:58 GMT
How tough would it be to get it to round to the .5?

> Oops sorry I misread. This rounds to the nearest 5 not .5
>
[quoted text clipped - 9 lines]
> View this thread: http://www.mcse.ms/message1738704.html
>  
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.