开发者

Formatting decimal number in excel 2007

开发者 https://www.devze.com 2023-04-05 03:14 出处:网络
I have tables with decimal numbers and i wnat that there will be maximum 2 digits after the point. e.g the number 4.567 will be 4.67, but the number 2 will stay 2开发者_如何学JAVA, and the number 5.6

I have tables with decimal numbers and i wnat that there will be maximum 2 digits after the point. e.g the number 4.567 will be 4.67, but the number 2 will stay 2开发者_如何学JAVA, and the number 5.6 will stay 5.6. How can i do that? I managed to do that there will be only two digits, but the number 2 converted to 2.00 and 5.6 to 5.60...


Format Cells->Number->Custom...and enter "0.##"

The "0" means "always displayed" (so in this case a digit before the decimal point). The "#" means "display if present" (so up to two digits after the decimal point). It's not quite perfect as "2" will display as "2.", but I think it's close as you're going to get


To add to @Ed 's answer, if you really want to display whole numbers without the . add a conditional format to the cell using formula (eg for cell A3)

=A3-TRUNC(A3,0)=0

and apply the general format


Related article: Excel 2007 ROUND Function

The syntax for the ROUND function is:

= ROUND ( Number, Num_digits )

1.Enter the following data into cell C1: 34.567
2.Click on cell D1 in the spreadsheet - this is where the function will be located.
3.Type " = round ( " in cell C1.
4.Click on cell D1 in the spreadsheet to enter the data in that cell into the formula.
5.Type a comma ( , ) followed by the number (one (1) or HOW MUCH YOU WANT) in cell D1 to indicate that the data should be reduced to one decimal place.
6.Type the closing bracket " ) " .
7.Press the ENTER key on the keyboard.
8.The answer 34.6 appears in cell D1.
9.If you click on cell D1, the complete function = ROUND ( 34.567 , 1 ) appears in the formula bar above the worksheet.

0

精彩评论

暂无评论...
验证码 换一张
取 消