Jump to content

Rounding issues


This topic is 2801 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi Folks,

 

 

I have a rounding issue which is probably very easy to solve if you know the correct function, which unfortunately I dont !!

 

We have a quoting database ... The system allows discounts so if something is £10.25 at list and they get 66% discount then the unit price after discount would actually be £3.485 but its rounded up to £3.49 and displays as per below....

 

e.g.   Product Code     Unit Price     Discount     Unit Price after discount     Qty     Line Price (after discount)

          Product A          10.15               66%          3.49                                   1          3.49               

          Product A          10.15               66%          3.49                                   2          6.97               

 

As you can see the second option when we have a Qty of 2, show the line price not equal to "2 x unit price after discount" ... 

 

I guess the rounding would need to be applied to the “Unit Price after discount” and the system would need to show this as £3.49 and if the qty is 2 then the line price needs to show £6.98 and not £6.97.

 

All advice will be very welcome and much appreciated folks

 

Many Thanks in advance

 

Regs

 

Dermot

Edited by Dermot
Link to comment
Share on other sites

The question that needs to answered first is what do you want to happen - IOW, what are your business rules.

  • If you want to apply the discount (and the subsequent rounding) to the unit price, then you should calculate the line price by multiplying the discounted unit price by quantity, i.e. 3.49 * 2 = 6.98;
  • If you want to apply the discount to the line price, then calculate 10.25 * 2 = 20.5 first, then apply the 66% discount to that, resulting in 6.97 and - if necessary - round it up to the nearest cent.

In any case, 6.97 is an odd number of cents, so if you want that to be your line price and also to display the discounted unit price in whole cents only, they will not add up.

Link to comment
Share on other sites

Thanks,

I want to round the discounted unit price to 3.49 ... (not just have the field show it as 3.49 when set to 2 decimal places).

it currently shows as 3.485 when you enter the field but I need this to actually round to 3.49 .. then everything else will work 100%

whats the best way to do this?

Thanks

Dermot

 

Link to comment
Share on other sites

32 minutes ago, Dermot said:

I want to round the discounted unit price to 3.49 ... (not just have the field show it as 3.49 when set to 2 decimal places).

Make the calculation =

Ceiling ( UnitPrice * ( 1 - Discount ) * 100 ) / 100

This is assuming you always want to round up, e.g. if the discounted price comes to 3.241, it will be rounded to 3.25. Otherwise use simply =

Round ( UnitPrice * ( 1 - Discount ) ; 2 )

 

 

Edited by comment
Link to comment
Share on other sites

This topic is 2801 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.