Home » excel » Excel 2007 Number with no decimals but not Auto-Rounded?

# Excel 2007 Number with no decimals but not Auto-Rounded?

Questions:

I seem to be having a fairly straightforward issue with Excel, although I cannot find a solution to it besides including a function.

Basically I would like to show a price in two fields, one for dollars and one for cents.

I have this working fine but the issue that I have is when I put say “24990.55” in the dollars field it will show “24991” in dollars and “55” in the cents field.

Is there any way I can force Excel to NOT Auto-Round?

If

`A1 = 24990.55`

then

• `=INT(A1)` will return 24990
• `=MOD(A1,1)` will return 0.55

You need a function to cut off the decimals. `Int()` will do that. `Mod()` will show only the decimal points.

I don’t know what behaviour you expect without using functions. Just formatting a number will not change its underlying value. This means that there is no formatting to show only the integer value and disregard the decimals without rounding. Excel does not work that way. Formatting to no decimal points will always include rounding. To work around that, you need a function to cut off the decimals.

If you want the cents to show as whole numbers, just multiply the `Mod()` result by 100. Edit: You talk about functions above, but reading other responses, I think what you actually mean is routine, a UDF or some other macro. You may want to get your terminology right when asking a question.

You really need to clarify what you want to achieve. It is not clear

• where you want the output, e.g. do you want the result in the same cell where the original number is entered? Where should the cents go, then?
• do you want the cents to be displayed as 0.55 or as 55?
• If you want the values (dollars and cents) to show in the same cell, what should that look like?
• if you want the values in two separate cells, please specify which cells for the dollars and which cells for the cents

Just putting a bounty on the question without clearly specifying your requirements does not help much.

Here is another approach, based on the following assumptions:

• the value with decimals is entered in column A
• the value should be changed in column A to show just the dollars (the integer)
• the value’s decimals will be shown in column C
• the decimals will be shown as whole numbers in column B

This can be achieved by the following change event macro:

``````Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("A:A")) Is Nothing Then
On Error Resume Next
Application.EnableEvents = False
Target.Offset(0, 2) = Target - Int(Target)
Target.Offset(0, 1) = (Target - Int(Target)) * 100
Target = Int(Target)
Application.EnableEvents = True
End If
End Sub
``````

Right-click the sheet tab, click “View Code” and paste the above code into the code window.

Of course, a much, much easier way to achieve exactly the same thing, without functions, without macros, without any VBA, can be done with exactly the same number of keystrokes as entering the number in a cell.

Compare these two sets of keystrokes

24990.55

with

24990Tab55

The second set of keystrokes will put the cents into their own cell, showing them as a whole number.

I’d really appreciate some feedback to the many suggestions that you have received in this thread.

You can use a second cell to calculate the value.
if your value is in cell A1, the formula would be

``````=A1-MOD(A1,1)
`````` If it’s an option, put your data entry on one worksheet (tab) and output the un-rounded output where you need the final answer..

It is not possible to do this. However, if you want an odd solution:

• Assuming the value is in A1, enter the formulas in B1 and C1, see screenshot.
• Insert a TextBox. As you drag to create it over cell A1, hold the Alt key so that it will fit the cell perfectly.
• Click onto the edge of the TextBox and type `=C1` in the formula bar.
• Click the Align-Right button on Ribbon; you can right-click, Format Shape, for other options.
• Format the textbox to a white background, and no outline (border).
• You can hide column C. You can copy and paste the shape into A2, it will change the formula to `=C2`. Use the Alt key again to resize the shape, if necessary, so that it fits the cell.

BTW: I am not recommending this approach, but it is an (unusual) answer to your question.

Just for giggles, here’s another solution.

Assuming you have existing data in columns, and you want to split the dollars and cents into two separate columns, you can use the Text to Columns feature.

In Excel 2007: Note that we’re on the Data tab. With your column highlighted, select Text to Columns and you’ll get the below dialog. Selected Delimited and hit next. On this screen, select Other and put a period into the field, like so: At this point, you can hit Finish and it will split them into two columns! Woohoo!

If you want to choose the destination and formatting for the fields, hit Next. Fancy!

Oh and here’s the results: Hurray, Excel!

Can you just format the cell as general or text? Those formats won’t round.

Alternatively, you could `ROUNDDOWN` your dollars cell so it always displays the proper dollar figure.

You can also use a formula like

``````=LEFT(A1,FIND(".",A1,1)-1)
``````

to separate the dollars and cents into separate cells. There are several ways to do this. It doesn’t need to be complicated if you’re willing to be a little creative.

Whatever route you take, you need to use 3 cells rather than 2. 1 cell for the full amount, 1 cell for dollars, and 1 cell for cents. You must have an input cell and 2 cells with formulas if you’re not going to use code to do this.

The number of decimals to be displayed can be set on the Tools menu under options.Select the number of decimals under Fixed decimal options.
Alternately you can use the INT function to extract only the integer portion of the value having decimals.

Unfortunately I don’t see how this is possible without functions.

The function you want is `TRUNC`. This will simply drop the decimal portion of your number.

As far as i understand you need to display something like this… And for achieving that you need to format that cell and in format you need to do this. TRUNC function does not round numbers. … The TRUNC function, short for truncate function is used to remove the decimal part of a number to a set

really you just need to use the left and find then add the number of decimals you want after the find. E.g., `=LEFT(H4,FIND(".",H4)+2)`

This is DEFINITELY possible! There is a clever workaround to show decimals as whole cents using a number format, and WITHOUT changing the actual value in the cell. Right click the cell and select Format Cells. On the Number tab, go to Custom.

In the custom number format “Type” field copy/paste the following:

``````# ¢
``````

Then type this keyboard combination:

``````CTRL + J
``````

And finally:

``````%
``````

Click OK to save the custom number format. Then set the cell format to “Wrap Text”.

The % symbol multiplies the number by 100 so your 0.37 shows as 37. It also adds a percent symbol to the format which you don’t want.

CTRL + J hides the percent symbol by inserting a CHR(10) line break that moves the percent symbol to a second line in the cell. Excel won’t auto-increase the row height for this cell so it stays hidden.

The end result is that a cell value of 0.37 displays as 37 ¢. For me this is much better than changing the cell value with a formula.