Another excel formula situation

2019-03-03 10:55发布

I want to be able to display a difference in seconds as (+4.15) or sometimes negatively as (-4.15) and include the parentheses and plus/minus sign.

How can I use a formula to display 34.47-30.32 so it comes out knowing whether or not the difference is positive or negative 4.15?

This is solved now except my next issue is small, but any number ending in 0, such as 4.10, will display as 4.1, without the extra 0. Using the formula given in the first comment, I can't format this to show exactly 4.10. Is it possible? not even cell formatting to show two decimal places works

3条回答
孤傲高冷的网名
2楼-- · 2019-03-03 11:08

Your desired results (e.g. +4.15 and -4.15 ) are not covered by the various available standard number formats but you can easily apply a custom number format aka CNF.

A CNF can have up to four parts; positive numbers, negative numbers, zero and text. The following will display positive numbers as black and a plus sign, negative numbers as red with a minus sign, a single grey dash instead of zero and blue text. The latter should never be actually used but the blue text will quickly show text that should have been interpreted as a number. The true numbers will be 'padded' off the right edge by a single space.

[Black]_(+#,##0.00_);[Red]_(-#,##0.00_);[Color10]_(* "-"_);[Blue]_(@_)

Example:

enter image description here

More on custom number formats at Create or delete a custom number format

查看更多
\"骚年 ilove
3楼-- · 2019-03-03 11:19

Something like this should work:

=TEXT(B1-A1,"+##.##;-##.##")

Though as Jon says - editing the cell format is far more appropriate generally to avoid an issue, select custom and use this:

+##.##;-##.##
查看更多
Melony?
4楼-- · 2019-03-03 11:22

You can achieve this with the regular cell formats option in excel.

Format your cells to show the number in this way. Or if you need something other than the already available options, then use custom formats.

enter image description here

查看更多
登录 后发表回答