ROUNDDOWN In Cell Format ONLY?

Centrican

Board Regular
Joined
Dec 20, 2006
Messages
130
Hey Guys,

Another bizzarre request from me:

I'm looking for a way to apply a rounddown function to values in cells, but to their format only, not the number itself.

e.g. I'm wanting to be able to enter 1.4 and 1.7, have both display as 1, yet add together to display 3.

I've tried everything I can think of to solve this, I'm starting to wonder if it is even possible.

Anyone got any thoughts about how I can achieve it?
 
Code:
Private Sub Worksheet_Calculate()
Dim c As Range
For Each c In ActiveSheet.UsedRange.Cells
    If IsNumeric(c) And c <> "" Then c.NumberFormat = Fix(c) & ";" & Fix(c)
Next
End Sub

Private Sub Worksheet_Change(ByVal Target As Range)
Dim c As Range
Application.EnableEvents = False
For Each c In Target
    If IsNumeric(c) And c <> "" Then c.NumberFormat = Fix(c) & ";" & Fix(c)
Next
Application.EnableEvents = True
End Sub
 
Upvote 0

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Hehe yeah the numbers are likely to be a lot higher than 31!

Ok, no worries I will do it with code, I just wanted to avoid having to change about 3000 pieces of output code.

Cheers for the input guys.
 
Upvote 0
OK, it's been pointed out that you can't have more than around 200 unique number formats, so it kinda depends on how many different numbers you might have.
 
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,827
Members
452,946
Latest member
JoseDavid

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