Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I want to select a column of numbers (B1:B1200) and format them with 4
decimals if they're between zero and one and with 2 decimals otherwise. I'd like to do this without an add-in (vba is ok). Thanks. |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Just run:
Public Sub reform() Set r = Range("B1:B1200") For Each rr In r v = rr.Value If v 0 And v <= 1 Then rr.NumberFormat = "0.0000" Else rr.NumberFormat = "0.00" End If Next End Sub and each item in the column will be correctly formatted. -- Gary''s Student - gsnu200750 "Steve" wrote: I want to select a column of numbers (B1:B1200) and format them with 4 decimals if they're between zero and one and with 2 decimals otherwise. I'd like to do this without an add-in (vba is ok). Thanks. |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
One way:
Format/Cells/Number/Custom [<0]-0.00;[<=1]0.0000;0.00 In article , Steve wrote: I want to select a column of numbers (B1:B1200) and format them with 4 decimals if they're between zero and one and with 2 decimals otherwise. I'd like to do this without an add-in (vba is ok). Thanks. |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
For positive numbers:
=IF(B11,ROUND(B1,2),ROUND(B1,4)) -- -John Please rate when your question is answered to help us and others know what is helpful. "Steve" wrote: I want to select a column of numbers (B1:B1200) and format them with 4 decimals if they're between zero and one and with 2 decimals otherwise. I'd like to do this without an add-in (vba is ok). Thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
conditional Formatting based on cell formatting | Excel Worksheet Functions | |||
conditional Formatting based on cell formatting | Excel Worksheet Functions | |||
=IF - conditional formatting | Excel Discussion (Misc queries) | |||
Conditional formatting | Excel Discussion (Misc queries) | |||
Conditional Formatting that will display conditional data | Excel Worksheet Functions |