is there a way to format a number so that:
if there are decimal places, you see: 1234.56 (which includes the "."
character),
but,
if it is a whole number, the display is: 1234 (without a decimal character,
i.e. not "1234.")
##0.## is not correct, since it always displays the "." character...
thanks in advance,
mark
You can format the cell as General and that will do as you describe.
However, if you always want two decimal places if the value is an integer, then
you can do this with an event-triggered macro. I don't know any way to do that
using just Excel built-in functions.
To use an event macro, right-click on the sheet tab and select View Code.
Paste the code below into the window that opens.
Change the range for AOI to the range you wish to have conditionally formatted.
Let me know if one of the suggestions help.
==========================================
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim AOI As Range
Dim c As Range
Set AOI = [a1:a10] 'set to range to be conditionally formatted
Application.EnableEvents = False
On Error Resume Next 'only error should be if text entered in AOI
For Each c In AOI
With c
If Int(.Value) = .Value Then
.NumberFormat = "General"
Else
.NumberFormat = "#,##0.00"
End If
End With
Next c
Application.EnableEvents = True
End Sub
=======================================
--ron