Forcing Cell formats, using round function?

mtb_rider

New Member
Joined
Feb 17, 2005
Messages
19
Hi

What I'm trying to do is on a summary page to express a calculated value in a "common sense" manner. So that if my criteria is that the value should be between 0.0999 and 1.0001 and my calculated value is 1.0000567 this gets rounded to 1.0001, likewise if my acceptable range is 49-51 and the calculated value is 50.114567 then the result will be rounded to 50.
There could be up to 7 sets of criteria and results all being transferred from calculation sheets via VBA. I actually want the rounded results not just the formatted to x decimals.

My design "idea" is that before transferring the data I will look at the number of decimal places that the range is expressed to and then round the answer prior to transfer.

Any ideas?

Thanks in advance
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
To get your result in the same number of decimal places, something like

=ROUND((B1-A1),LEN(MOD(A1,1))-2),

Where B1-A1 is an arithmetic argument yielding your desired result - before rounding occurs (could be any argument you wish),
A1 contains one of the numbers for the function to use to match number of decimal places to use.
 
Upvote 0

Forum statistics

Threads
1,214,534
Messages
6,120,080
Members
448,943
Latest member
sharmarick

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