You would need conditional formatting.
In this example, the numbers will range from A1 down.
Highlight the cells, starting at A1
Go to Home, Conditional Formatting, New Rule, and then Use a Formula to Determine Which Cells to Format.
For whole numbers:
For the formula, use =MOD(A1,1)=0
For the format, select number, go to custom, and type #" hrs"
For decimals:
For the formula, use =MOD(A1,1)<>0
For the format, select number, go to custom, and type #.#" hrs"
if you want commas, then the first format would be #,#" hrs"
and the second would be #,#.#" hrs"