Right click on your worksheet tab and view code.
Add the following code to the worksheet VBA editor.
The code runs everytime a value is column B changes, (change to your column)
Formats the cell based on your critria.
Private Sub WorkSheet_Change(ByVal Target As Range)
If Cells(Target.Row, Target.Column) = 0 Then Cells(Target.Row,
Target.Column).NumberFormat = "0"
If Cells(Target.Row, Target.Column) = Empty Then Exit Sub
If Target.Column = 2 Then 'column B
If Cells(Target.Row, Target.Column) > 999 Then 'Add commas to greater
than 999
Cells(Target.Row, Target.Column).NumberFormat = "#,###"
ElseIf Cells(Target.Row, Target.Column) = Int(Cells(Target.Row,
Target.Column)) Then '10.0
Cells(Target.Row, Target.Column).NumberFormat = "0"
Else '10.5
Cells(Target.Row, Target.Column).NumberFormat = "0.0"
End If
End If
End Sub