Explanation on formula

Hiten Vakharia

Board Regular
Joined
Sep 25, 2013
Messages
66
Hi,
I have come across below forumla, this is for rounding price

Could anyone explain what does this mean
=IF(A3="","",IF(A3<7,CEILING(A3,0.1)-0.01,IF(A3<20,CEILING(A3,0.5)-0.01,CEILING(A3,1)-0.01)))

Thanks
Hiten
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
That formula is taking your price in A3 and rounding it to end in .99 cents. If it's a whole number, it rounds down (50 becomes 49.99). If it's a decimal, it rounds up (50.15 becomes 50.99).

But if it's less than 7, it's rounding the price to the nearest tenth (5.3 becomes 5.29). If it's less than 20, it rounds to the nearest half dollar (15.3 becomes 15.49).
 
Last edited:
Upvote 0
If A3 is blank, blank

If A3 < 7, return .01 less than the next largest dime interval.
eg. 6.45 rounds up to 6.50, then return .01 less, or 6.49.

If A3 between 7 and 20, return .01 less than the next largest half dollar interval
eg. 9.4 rounds up to 9.50, then returns .01 less, or 9.49.
9.8 rounds up to 10.00, then returns .01 less, or 9.49.

If A3 is larger or equal to 20, return .01 less than the next largest full dollar interval
eg. 35.1 rounds up to 36.00, then returns .01 less, or 35.99.
 
Upvote 0

Forum statistics

Threads
1,214,427
Messages
6,119,419
Members
448,895
Latest member
omarahmed1

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