在另一个中使用aformula的输出 [英] Using an output of aformula in another

查看:54
本文介绍了在另一个中使用aformula的输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人在此发布此公式,作为对问题的答案:如何使用公式来知道使用了多少个单元格来创建合并的单元格:

Someone here posted this formula as an answer to the qustion how can one use a formula to know how many cells were used to create a merged cell:

Public Function MergeSize(r As Range) As Long
    MergeSize = r(1).MergeArea.Cells.Count
End Function

该公式效果很好,我想将其输出到 If >> Then 参数中.

The formula works great, and I would like to use it's output into an If >> Then argument.

例如,如果输出小于10,则乘以70.如果输出大于10,则将其乘以65,依此类推.

For example if the output is smaller than 10 then multiply by 70. If its bigger than 10 then multiply it by 65 and so on.

推荐答案

请参见有关功能用作 UDF 的编辑答案.

See edited answer for to Function to serve as UDF.

Public Function MergeSize(r As Range) As Long

MergeSize = r(1).MergeArea.Cells.Count

If MergeSize <= 10 Then
    MergeSize = MergeSize * 70
Else
    MergeSize = MergeSize * 65
End If

End Function

在Excel工作表中如何应用它:

How it is applied to in an Excel Sheet:

(在此示例中,由于"B2"由8个合并的单元格组成,因此您将乘以 8 * 70 = 560 .)

(In this example, Since "B2" consist of 8 merged cells, you multiply 8 * 70 = 560.)

这篇关于在另一个中使用aformula的输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆