Help with complex custom cell format - NOT VBA

AmandaCatRuth

Board Regular
Joined
Apr 20, 2012
Messages
79
I need to use cell formatting to display numbers rounded to the nearest 10th, as such:

Code:
 1022.5468734654 ->  1020 
 1029.5468734654 ->  1030
10222.5468734654 -> 10220

This will need to work for values of 1000-15000.

I know this can be done with mround, but the function is visible when the cell is clicked on. Pasting over values will ruin all of the trailing decimals, which I need to keep. Cell formatting is the only thing I can think of that will display the numbers nicely, but also will show the correct number as the actual value of the cell.

However, I have no idea how to write a custom format that will do this.

Any suggestions?
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Can you use a helper column and a formula like =ROUND(A2,-1)
 
Upvote 0
There is no custom format that will do that, I'm afraid.
 
Upvote 0
I ended up doing this:

Code:
Sub Custom_Format_Set()
    
Dim rng As Range
Dim RD As String
Set rng = Selection
    For Each c In rng
    
    If c.Value >= 1000 Then
        RD = WorksheetFunction.MRound(c.Value, 10)
        c.NumberFormat = Chr(34) & RD & Chr(46) & Chr(34)
    
    End If
Next
End Sub

Which isn't as efficient as I was hoping, but it will get the job done.
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,971
Members
452,371
Latest member
Frana

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