array split_Array()和Split()性能比较

array split

介绍 (Introduction)

关于最近的一个问题,我提供了一个简单的函数来格式化带后缀的数字,以表示其大小(MB,GB,TB等)。 虽然功能很简单,但我想知道是否提供了最有效的代码。 本文比较了Array()和Split()函数的性能。

()

The Problem

The question (

问题

问题( http:Q_28494315.html) stated a need to add the scale suffix to a number.  Excel did not provide the ability to format cell values this way and conditional formatting does not affect the cell's value.  The cell still contains a numeric value, while Excel displays the formatted value. http:Q_28494315.html )表示需要在数字后加上小数位数后缀。 Excel没有提供以这种方式格式化单元格值的功能,并且条件格式设置不会影响单元格的值。 单元格仍包含数字值,而Excel显示格式化的值。

()

Example:

例:

12345600 = 12.3456 MB

12345600 = 12.3456 MB

1234560000 = 1.23456 GB

1234560000 = 1.23456 GB

()

The Accepted and Alternative Solutions

Since there were only three possible suffixes, the conditional formatting solution was the simplest and the one accepted as the question solution.

公认的和替代的解决方案

由于只有三个可能的后缀,因此条件格式解决方案是最简单的,而一个被接受为问题解决方案。
[>999999999999]0.00,,,,"TB";[>999999999]0.00,,,"GB";0.00,,"MB"
ConditionalFormattingRulesMgr.jpg

()

The User-Defined Function Solutions

Let's start with a routine that uses an Array() function, most closely resembling the question's solution.  If the magnitude of the parameter value is greater than 1000, we use the base1000 log of the number to index into the Array() values.

用户定义的功能解决方案

让我们从使用Array()函数的例程开始,该例程最类似于问题的解决方案。 如果参数值的大小大于1000,则使用数字的base1000对数来索引Array()值。
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值