Well, CLng rounds to the nearest even number.
?CLng(24.5)
24
?CLng(25.5)
26
Round does the same thing:
?Round(24.5, 0)
24
?Round(25.5, 0)
26
Int truncates:
?Int(24.5 + 0.5)
25
?Int(25.5 + 0.5)
26
So I suppose you could do:
IIf(Int(<number> + 0.5) Mod 2 = 0, Int(<number> + 0.5) - 1, Int(<number> + 0.5))
?IIf(Int(23.5 + 0.5) Mod 2 = 0, Int(23.5 + 0.5) - 1, Int(23.5 + 0.5))
23
?IIf(Int(24.5 + 0.5) Mod 2 = 0, Int(24.5 + 0.5) - 1, Int(24.5 + 0.5))
25
?IIf(Int(25.5 + 0.5) Mod 2 = 0, Int(25.5 + 0.5) - 1, Int(25.5 + 0.5))
25
John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
SQL Queries for Mere Mortals
(Paris, France)
On May 16, 2014, at 2:59 PM, metazone63@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:
Dear All,
Want to ask ya,
What function / formula for rounding fractions (0.5) to the nearest odd number.
Suppose that:
Figures 23.5 -> Round to 23.0
Figures 24.5 -> Round to 25.0
Number other than multiples of 0.5 using the usual rounding.
If its formula in Excel Odd & Even, but in the access I have not found his formula.
Please help my friends if anyone knows his solution.
So, thank you for your help .........
__._,_.___
| Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (2) |
Just launched ! Link preview on Yahoo Groups
Visit your Group on the web, simply paste the link to the article, photo or video you wish to share in the message you are composing.
.
__,_._,___
Tidak ada komentar:
Posting Komentar