create account

每天进步一点点:Excel的四舍五入 & 向下、向上截取 by oflyhigh

View this thread on: hive.blogpeakd.comecency.com
· @oflyhigh ·
$20.76
每天进步一点点:Excel的四舍五入 & 向下、向上截取
在我之前的帖子:[原来Excel也很好用呀](https://steemit.com/cn/@oflyhigh/excel),提到我开始使用Excel完成一个以前一直用Word+计算器+手工填写来完成的一项周期性任务。用了一段时间后,发现还真是舒服啊,每次至少节省我半个小时以上时间。

![](https://steemitimages.com/DQmRkLq6rRew3mHfx4vYGWyqpC8wSebLPeC2iZCXAdpuGkR/image.png)
(图源 :[pixabay](https://pixabay.com/))

但是还有有一点美中不足,表格中我计算出来几个数值,小数部分多达八位,我需要将这个数值填写到某一网站上去,长达八位的数值,填起来有点累,于是我就采取四舍五入的方式。

而所谓的四舍五入,就是我肉眼去看这个数字,然后在大脑里简单运算一下,四舍五入取小数点后四位。这样做一般来讲并没有什么问题,但是偶尔会遇到大脑短路,计算出来的结果跑偏;或者眼睛短路,肉眼看数字就看串位😂。

# 四舍五入
今天突然想,Excel这么高级的工具应该支持四舍五入吧?比如PHP和Python中都支持***`ROUND函数`***,那么Excel是不是也支持呢?

于是直接写了类似如下的测试
>`=ROUND(H32, 4)`

其中H32是我之前计算出的一个数据对应的单元格,4表示保留小数点后4位,ROUND表示四舍五入。结果灰常完美,我猜对了,看来这些语言都有共同之处呢。

# 向上、向下截取

那么既然ROUND没问题,是不是`CEIL`以及`FLOOR`都可以用,并且行为和PHP啥的都一致呢?测试了一下,原来Excel中这两个函数分别叫做`CEILING`与`FLOOR`,并且比其它语言中的`CEIL`以及`FLOOR`高级多了。

语法如下:
>`CEILING(number, significance)`
>`FLOOR(number, significance)`

分别代表返回将参数 number 向上/下舍入(沿绝对值增大/减少的方向)为最接近的指定基数的倍数,是不是很有意思?

当然了,对我而言,这两个函数一般我用不到,Excel还有两个弱化版的处理函数,分别为:
>`ROUNDUP(number,num_digits)`
>`ROUNDDOWN(number,num_digits)`

不同于四舍五入,这两个函数分别代表向上截取,和向下截取,支持小数,虽然是弱化版,但是也相当强大了。

![](https://cdn.steemitimages.com/DQmVQhLq1fqhp4QGwi2mdGVKGghzPQJo8bggYzCdDW5WiKk/image.png)
(图源 :[pixabay](https://pixabay.com/))

总之,越来越喜欢Excel啦。

----
<center><strong>Vote For Me As Witness</strong>
https://steemit.com/~witnesses type in **`oflyhigh`** and click ***`VOTE`***
[![](https://cdn.steemitimages.com/DQmX5NysqT44FBa3bhuWqQ69nAbseu8Nt5YQPn2pYejPVxA/image.png)](https://steemit.com/~witnesses)
[Vote @oflyhigh via Steemconnect](https://steemconnect.com/sign/account-witness-vote?witness=oflyhigh&approve=1)
<strong>Thank you!</strong></center>
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 110 others
properties (23)
authoroflyhigh
permlinkexcel-and
categorycn
json_metadata{"tags":["cn","life","excel","work","study"],"image":["https://steemitimages.com/DQmRkLq6rRew3mHfx4vYGWyqpC8wSebLPeC2iZCXAdpuGkR/image.png","https://cdn.steemitimages.com/DQmVQhLq1fqhp4QGwi2mdGVKGghzPQJo8bggYzCdDW5WiKk/image.png","https://cdn.steemitimages.com/DQmX5NysqT44FBa3bhuWqQ69nAbseu8Nt5YQPn2pYejPVxA/image.png"],"links":["https://steemit.com/cn/@oflyhigh/excel","https://pixabay.com/","https://steemit.com/~witnesses","https://steemconnect.com/sign/account-witness-vote?witness=oflyhigh&approve=1"],"app":"steemit/0.1","format":"markdown"}
created2018-12-15 01:32:51
last_update2018-12-15 01:32:51
depth0
children6
last_payout2018-12-22 01:32:51
cashout_time1969-12-31 23:59:59
total_payout_value15.802 HBD
curator_payout_value4.955 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,629
author_reputation6,361,877,432,349,447
root_title"每天进步一点点:Excel的四舍五入 & 向下、向上截取"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd0
post_id76,855,299
net_rshares35,330,531,446,899
author_curate_reward""
vote details (174)
@maiyude ·
$0.03
居然会用函数了,这下10后没法鄙视你了。
👍  
properties (23)
authormaiyude
permlinkre-oflyhigh-excel-and-20181215t013635765z
categorycn
json_metadata{"tags":["cn"],"app":"steemit/0.1"}
created2018-12-15 01:37:06
last_update2018-12-15 01:37:06
depth1
children1
last_payout2018-12-22 01:37:06
cashout_time1969-12-31 23:59:59
total_payout_value0.023 HBD
curator_payout_value0.007 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length20
author_reputation8,970,701,360,387
root_title"每天进步一点点:Excel的四舍五入 & 向下、向上截取"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id76,855,392
net_rshares52,954,039,783
author_curate_reward""
vote details (1)
@oflyhigh ·
😂让鄙视来的更猛烈些吧
properties (22)
authoroflyhigh
permlinkre-maiyude-re-oflyhigh-excel-and-20181215t015624559z
categorycn
json_metadata{"tags":["cn"],"app":"steemit/0.1"}
created2018-12-15 01:56:33
last_update2018-12-15 01:56:33
depth2
children0
last_payout2018-12-22 01:56:33
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length11
author_reputation6,361,877,432,349,447
root_title"每天进步一点点:Excel的四舍五入 & 向下、向上截取"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd0
post_id76,855,898
net_rshares0
@nuagnorab ·
$0.08
感覺可能 O 哥用 python import pandas 來操作 excel files 會比直接打開 excel app 更自在更快呢 😂

Posted using [Partiko iOS](https://steemit.com/@partiko-ios)
👍  
properties (23)
authornuagnorab
permlinknuagnorab-re-oflyhigh-excel-and-20181215t053752227z
categorycn
json_metadata{"app":"partiko"}
created2018-12-15 05:37:51
last_update2018-12-15 05:37:51
depth1
children1
last_payout2018-12-22 05:37:51
cashout_time1969-12-31 23:59:59
total_payout_value0.060 HBD
curator_payout_value0.019 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length134
author_reputation125,097,310,898,849
root_title"每天进步一点点:Excel的四舍五入 & 向下、向上截取"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id76,862,089
net_rshares134,958,436,619
author_curate_reward""
vote details (1)
@oflyhigh ·
不明觉厉
properties (22)
authoroflyhigh
permlinkre-nuagnorab-nuagnorab-re-oflyhigh-excel-and-20181215t095603941z
categorycn
json_metadata{"tags":["cn"],"app":"steemit/0.1"}
created2018-12-15 09:56:06
last_update2018-12-15 09:56:06
depth2
children0
last_payout2018-12-22 09:56:06
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length4
author_reputation6,361,877,432,349,447
root_title"每天进步一点点:Excel的四舍五入 & 向下、向上截取"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd0
post_id76,869,413
net_rshares0
@partiko ·
Thank you so much for participating the Partiko Delegation Plan Round 1! We really appreciate your support! As part of the delegation benefits, we just gave you a 3.00% upvote! Together, let’s change the world!
properties (22)
authorpartiko
permlinkre-excel-and-20181215t023016
categorycn
json_metadata""
created2018-12-15 02:30:18
last_update2018-12-15 02:30:18
depth1
children0
last_payout2018-12-22 02:30:18
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length210
author_reputation39,207,160,334,751
root_title"每天进步一点点:Excel的四舍五入 & 向下、向上截取"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id76,856,719
net_rshares0
@paulag ·
$0.08
great excel tip ( and thank god for google translate )
👍  
properties (23)
authorpaulag
permlinkre-oflyhigh-excel-and-20181219t000505818z
categorycn
json_metadata{"tags":["cn"],"app":"steemit/0.1"}
created2018-12-19 00:05:06
last_update2018-12-19 00:05:06
depth1
children0
last_payout2018-12-26 00:05:06
cashout_time1969-12-31 23:59:59
total_payout_value0.057 HBD
curator_payout_value0.018 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length54
author_reputation274,264,287,951,003
root_title"每天进步一点点:Excel的四舍五入 & 向下、向上截取"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id77,040,338
net_rshares132,926,601,794
author_curate_reward""
vote details (1)