Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I would like to have the result of the following line display with
only one decimal place. As written, it consistently displays to five decimal places. Obviously, because the output location is defined with a variable, I can't pre-format the cell it will be in. numQs and numWrong are Integers. Cells(I + 2, "B").Formula = "=" & (numQs - numWrong) / numQs & "*100" |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
With Cells(I + 2, "B")
.Formula = "=" & Format((numQs - numWrong) / numQs,"0.0") & "*100" End With Would be my guess at what you want. Another interpretation might be: With Cells(I + 2, "B") .Formula = "=" & (numQs - numWrong) / numQs,"0.0" & "*100" .NumberFormat:="#,##0.0" End With The first puts one decimal place in the formula, the second formats the cell to only display one decimal place for the formula result. -- Regards, Tom Ogilvy "John Pierce" wrote in message om... I would like to have the result of the following line display with only one decimal place. As written, it consistently displays to five decimal places. Obviously, because the output location is defined with a variable, I can't pre-format the cell it will be in. numQs and numWrong are Integers. Cells(I + 2, "B").Formula = "=" & (numQs - numWrong) / numQs & "*100" |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
try something like this
Selection.NumberFormat = "0.0" "John Pierce" wrote in message om... I would like to have the result of the following line display with only one decimal place. As written, it consistently displays to five decimal places. Obviously, because the output location is defined with a variable, I can't pre-format the cell it will be in. numQs and numWrong are Integers. Cells(I + 2, "B").Formula = "=" & (numQs - numWrong) / numQs & "*100" |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
number formatting | Excel Discussion (Misc queries) | |||
number formatting | Excel Discussion (Misc queries) | |||
Formatting a number | Excel Worksheet Functions | |||
number formatting | Excel Worksheet Functions | |||
formatting cell number based on previous cell number | Excel Discussion (Misc queries) |