Rounding Formula Question

ChrisHockley

New Member
Joined
Feb 6, 2017
Messages
30
Hello all,

Thanks in advance for any help you can offer.

Rounding - I'm working on some pricing and once the pricing is done I am adding a percentage to convert these prices to MSRP. This of course creates all kinds of random dollar amounts with no consistency. I need help setting up a formula that would do the following to the price (x)

a. if x is less than or equal to .11 over the nearest dollar then round down to .99 cents of the previous dollar
b. if x is .12 to .24 over the dollar round to that dollar and .19 cents
c. if x is .25 to .40 over the dollar round to that dollar and .29 cents
d. if x is .41 to .65 over the dollar round to that dollar and .49 cents
e. if x is .66 to .90 over the dollar round to that dollar and .79 cents
f. if x is .91 to .10 over the dollar round to the closest dollar and .99 cents

Wow... I just got a stress headache typing that out let alone the formula!

All I would greatly appreciate any and all attempts to assist!

Chris H.
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
I just knew there was a trick to creating prices! :eek:

Try this:

BC
1 $ 1.36 $ 1.29
2 $ 2.94 $ 2.99
3 $ 9.24 $ 9.19
4 $ 7.99 $ 7.99
5 $ 1.19 $ 1.19
6 $ 8.46 $ 8.49
7 $ 9.92 $ 9.99
8 $ 7.28 $ 7.29
9 $ 4.53 $ 4.49
10 $ 5.08 $ 4.99
11 $ 3.09 $ 2.99
12 $ 1.06 $ 0.99
13 $ 6.74 $ 6.79
14 $ 8.42 $ 8.49
15 $ 9.67 $ 9.79
16 $ 8.41 $ 8.49
17 $ 8.12 $ 7.99
18 $ 6.29 $ 6.29
19 $ 9.51 $ 9.49
20 $ 1.03 $ 0.99

<colgroup><col style="width: 25pxpx"><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet4

Worksheet Formulas
CellFormula
C1=INT(B1)+LOOKUP(MOD(B1,1),{0,0.12,0.25,0.41,0.66,0.91},{-0.01,0.19,0.29,0.49,0.79,0.99})

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>
 
Upvote 0
:eek: holy crap... that works... I'm admittedly scratching my head and wondering how to interpret this masterpiece... lots of elements I haven't seen before. INT, LOOKUP, MOD.

Grateful. Awed and appreciative.

Thanks!
 
Upvote 0
INT (integer) gives you the dollar amount without the cents.

MOD(B1,1) gives you the cents amount without the dollars.

LOOKUP finds the location in the first array where the cents goes (equal or greater than one value, less than the next), and gets the corresponding value from the second array. So it basically finds the cents value to use for the range you gave, and adds that to the dollar amount.

Happy I could help! :cool:
 
Upvote 0
Eric,

Thank you for the explanation!!!

A question for you. This rounding formula you have here is perfect for items that I say 5 dollars and less. Is there a way to build into the formula the following parameters or does each need to have it's own formula as i have been doing? Up to this point i have been using these by sorting the dollar values then pasting the following.

$5 to $20
ROUNDUP(x/0.5,0)*0.5-0.01
Under $50
=IF(A1-INT(A1)<0.1,INT(A1),ROUNDUP(A1,0))-0.01
anything under .10 over the 1 will round down
Over $50
=MROUND(A1+1.49,5)-0.01
anything under 1 over the 5 will round down
Over $500
=MROUND(A1+1.49,10)-0.01
anything under 3.50 over the 10 will round down

<colgroup><col span="2"></colgroup><tbody>
</tbody>
 
Upvote 0
Well, if you want to combine all those formulas into one, you could use LOOKUP to decide the range for each formula, then use CHOOSE to use the formula.

=CHOOSE(LOOKUP(A1,{0,5,20,50,500},{1,2,3,4,5}),INT(A1)+LOOKUP(MOD(A1,1),{0,0.12,0.25,0.41,0.66,0.91},{-0.01,0.19,0.29,0.49,0.79,0.99}),ROUNDUP(2*A1,0)/2-0.01,IF(MOD(A1,1)<0.1,INT(A1),ROUNDUP(A1,0))-0.01,MROUND(A1+1.49,5)-0.01,MROUND(A1+1.49,10)-0.01)
 
Upvote 0
Eric,

Would you be able to assist me in further refining this formula you have created? It does exactly what I had needed it to do however in using it I have found errors of my own making as I left out details that I did not think of at the time...

$5 to $20
ROUNDUP(x/0.5,0)*0.5-0.01
It would be ideal if anything from .75 of the previous the dollar to .24 cents above the dollar would round up/down to .99 of the dollar. Anything .25 to .74 above the dollar would round up/down to the .49.
 
Upvote 0
Try:

=CHOOSE(LOOKUP(A1,{0,5,20,50,500},{1,2,3,4,5}),INT(A1)+LOOKUP(MOD(A1,1),{0,0.12,0.25,0.41,0.66,0.91},{-0.01,0.19,0.29,0.49,0.79,0.99}),MROUND(A1,0.5)-0.01,IF(MOD(A1,1)<0.1,INT(A1),ROUNDUP(A1,0))-0.01,MROUND(A1+1.49,5)-0.01,MROUND(A1+1.49,10)-0.01)
 
Upvote 0

Forum statistics

Threads
1,216,189
Messages
6,129,418
Members
449,509
Latest member
ajbooisen

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top