Rounding Off

  • Thread starter Thread starter sparky3883
  • Start date Start date
S

sparky3883

Hi All

I was just wondering if there was a way of Excel showing a numbe
without rounding it off?

When I enter a number like 7.8, it rounds it off to 8.0, and i was jus
wondering if there was a way to stop this from happening as i woul
prefer the 7.8 to be shown.

Thanks in advance

Mar
 
Hi All

I was just wondering if there was a way of Excel showing a number
without rounding it off?

When I enter a number like 7.8, it rounds it off to 8.0, and i was just
wondering if there was a way to stop this from happening as i would
prefer the 7.8 to be shown.

Thanks in advance

Mark

Is Excel "displaying" 7.8 as 8.0, or is it "storing" your entry of 7.8 as 8?
(Check the formula bar to see what's really in the cell).

If the former, then it is a cell formatting issue. Format/Cells/Number and
select General, or Number with the desired number of decimal places.


--ron
 
Thanks for your help, but i am still having no joy with it.

When i enter a certain letter in to a cell, it is represented by
number in the next cell. For example, when i enter E onto a cell, 7.
SHOULD be shown in the cell next to it. HOwever, this is not the cas
and 8.0 is actually being shown. When i look in the formula bar, 8.0 i
still being shon.

When i go to Format/Cells/Number, i have it set to one decimal plac
which is all i need, but it still rounds it up and i could really d
with it showing the actual 7.8.

Is there a way of getting round this?

Thanks agai
 
Hi
what frmula do you use in the adjacent cell or do you use an event
macro for this?
 
You seem to have missed out something. If typing E in one cell make another
cell display a number then the second cell must have a formula in it. Please
tell us what it is.
Bernard
 
Thanks for your help, but i am still having no joy with it.

When i enter a certain letter in to a cell, it is represented by a
number in the next cell. For example, when i enter E onto a cell, 7.8
SHOULD be shown in the cell next to it. HOwever, this is not the case
and 8.0 is actually being shown. When i look in the formula bar, 8.0 is
still being shon.

When i go to Format/Cells/Number, i have it set to one decimal place
which is all i need, but it still rounds it up and i could really do
with it showing the actual 7.8.

Is there a way of getting round this?

Thanks again

Since the formula bar is showing 8.0 and not a formula, the conversion is
probably being done by an event driven macro.

Try the following:

Right-click on the sheet tab.
Select "View Code"
Copy the window that appears and post it here.
Also post the cell reference into which you type the 'E' and also where
the 7.8 should appear.


--ron
 
Many thanks again for your reply.
The coding that i am using is pasted below. As you can see, when yo
enter teo of the three letters, they are meant to be displayed a
decimal places, but, for some reason, they just get rounded off and
could really do with these exact numbers being shown.




Dim rng As Range
Dim vRngInput As Variant
Dim n As Long
Dim Num As Long


Set vRngInput = Intersect(Target, Range("B:B"))
n = Target.row
If vRngInput Is Nothing Then Exit Sub
For Each rng In vRngInput
'Determine the range
Select Case rng.Value
Case "E": Num = 7.8
Case "L": Num = 8
Case "Q": Num = 8.4
End Select
'Apply the Number
Excel.Range("C" & n).Value = Num
Next rng

Many thanks again for all your hel
 
Many thanks again for your reply.
The coding that i am using is pasted below. As you can see, when you
enter teo of the three letters, they are meant to be displayed as
decimal places, but, for some reason, they just get rounded off and i
could really do with these exact numbers being shown.




Dim rng As Range
Dim vRngInput As Variant
Dim n As Long
Dim Num As Long


Set vRngInput = Intersect(Target, Range("B:B"))
n = Target.row
If vRngInput Is Nothing Then Exit Sub
For Each rng In vRngInput
'Determine the range
Select Case rng.Value
Case "E": Num = 7.8
Case "L": Num = 8
Case "Q": Num = 8.4
End Select
'Apply the Number
Excel.Range("C" & n).Value = Num
Next rng

Many thanks again for all your help

Solution is easy.

'Long' is an integer variable.

If you Dim Num as Double, you will get the result you are seeking.
--ron
 
Back
Top