Round numbers, then remove all decimals

Mark Green

Board Regular
Joined
Apr 15, 2016
Messages
125
I have a column of 170+ numbers that have different decimal places.
Some say, 297.4356, another 454.27, another 386.537 etc.
For each number in the column I would first like to round the number up or down,
THEN remove the decimals completely.

So that when you highlight a cell and look at the top bar you see only the integer, no decimal at all.

I hope someone can tell me how I can achieve this?

TIA
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Code:
Sub Main()
  With Selection
    .NumberFormat = "#"
    .Value = .Value
  End With
End Sub
 
Upvote 0
In a spare column, insert:
=ROUND(A1,0)
where A1 is the reference to the first data cell you want to round.
Copy down to the end of your range.
Copy the range with the formula
Paste into the first data cell, using Paste Special>Values
Delete the formulae.
 
Upvote 0
Replace #2 wih:
Code:
Sub Main()
  Dim c As Range
  Selection.NumberFormat = "General"
  For Each c In Selection
    c.Value = Round(c.Value, 0)
  Next c
End Sub
 
Upvote 0
Thanks very much Kenneth and Paul!
Your solutions worked out nicely. Had to try them both. :)
Now I can compare a second column of numbers (integers) for any differences.
 
Upvote 0
If that's all you needed to do, you could have used a formula like:
=ROUND(A1,0)-B1
where A1 holds the raw number and B1 holds the supposedly-rounded one. Any non-zero results would represent material differences.
 
Upvote 0
If that's all you needed to do, you could have used a formula like:
=ROUND(A1,0)-B1
where A1 holds the raw number and B1 holds the supposedly-rounded one. Any non-zero results would represent material differences.

Now that was really cool too! I just had to try it out also.
I would say that is the easiest method. I’ll file it away
if I need to compare numbers again in the future.
Thanks again!
 
Upvote 0

Forum statistics

Threads
1,214,621
Messages
6,120,563
Members
448,972
Latest member
Shantanu2024

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