GDavis88 Posted January 16, 2009 Share Posted January 16, 2009 (edited) Hi everybody i am having serious trouble. I have a total cost field that i am trying to have round up or down to the nearest .05 Round ( (Cost + Sales Tax) ; .05 ) i have tried that but it almost always gives me a whole amount EX. $4.47 = $4.00 What i would like is for $4.47 to equal $4.45 so please any help would be greatly appreciated Edited January 16, 2009 by Guest Link to comment Share on other sites More sharing options...
comment Posted January 16, 2009 Share Posted January 16, 2009 Try: Round ( n / 0.05 ; 0 ) * 0.05 Link to comment Share on other sites More sharing options...
GDavis88 Posted January 16, 2009 Author Share Posted January 16, 2009 Perfect! thank you comment Link to comment Share on other sites More sharing options...
GDavis88 Posted January 16, 2009 Author Share Posted January 16, 2009 comment im sorry but i was wrong i need it to only round down if you could be so nice to help me again Link to comment Share on other sites More sharing options...
comment Posted January 16, 2009 Share Posted January 16, 2009 Rather obvious, no? Floor ( n / 0.05 ) * 0.05 Link to comment Share on other sites More sharing options...
GDavis88 Posted January 16, 2009 Author Share Posted January 16, 2009 that is working great but on occasion it will round when it shouldnt EX. 24.45 + 1.25 = 25.70 but it will take that and round it to 25.65 Link to comment Share on other sites More sharing options...
comment Posted January 16, 2009 Share Posted January 16, 2009 Most likely, your data is not what you think it is - e.g. the 1.25 is actually 1.249999999. Link to comment Share on other sites More sharing options...
GDavis88 Posted January 16, 2009 Author Share Posted January 16, 2009 you were right as always but is there a way to make it not do that? im guessing i would have to put a round calculation in the sales tax calculation field? Link to comment Share on other sites More sharing options...
GDavis88 Posted January 16, 2009 Author Share Posted January 16, 2009 (edited) so i think i got it would this be right Ceiling ( (Cost * .051) * 10 ^ 2 ) * 10 ^ -2 Edited January 16, 2009 by Guest Link to comment Share on other sites More sharing options...
comment Posted January 17, 2009 Share Posted January 17, 2009 There's no single correct answer here - it all depends on the reason behind the rounding. Obviously, if you're rounding twice, you may get a discrepancy. It's best to round EITHER the tax OR the total. Link to comment Share on other sites More sharing options...
Recommended Posts
This topic is 5579 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now