subtotal函数_用SUBTOTAL更改Excel函数

subtotal函数

We looked at the Excel SUBTOTAL function on Friday, and saw how it works with hidden rows. The first argument tells Excel which function you want to use, such as SUM, MAX or AVERAGE. See how to make it easy for people to change Excel function with SUBTOTAL, to get a different result.

我们在星期五查看了Excel SUBTOTAL函数 ,并了解了它如何与隐藏行一起工作。 第一个参数告诉Excel您要使用哪个函数,例如SUM,MAX或AVERAGE。 了解如何使人们轻松使用SUBTOTAL更改Excel函数以获得不同的结果。

小计功能编号 (SUBTOTAL Function Numbers)

When you start typing the SUBTOTAL function, you'll see this list of function numbers. You can type one of the numbers, or double-click on an item in the drop down list.

当您开始输入SUBTOTAL函数时,您会看到此函数编号列表。 您可以键入数字之一,或双击下拉列表中的项目。

subtotal05b

改变功能 (Change the Function)

Instead of typing the first argument in a SUBTOTAL formula, you could make it more flexible, by allowing users to select the function they want. In this example, we'll set up total formulas, and users can change the function at any time.

通过允许用户选择所需的函数,可以使它更灵活,而不是在SUBTOTAL公式中键入第一个参数。 在此示例中,我们将设置总计公式,用户可以随时更改函数。

subtotalselect05

设置命名Excel表 (Set Up the Named Excel Table)

In this example, there are sales orders, in an Excel table named SalesTable. We'll create totals for the Qty, Cost and Amt columns in that table.

在此示例中,在名为SalesTable的Excel表中有销售订单。 我们将在该表中为“数量”,“成本”和“金额”列创建总计。

subtotalselect00

列出小计功能 (List the SUBTOTAL Functions)

In the Excel Help files, if you search for SUBTOTAL, you'll find a table of the functions and their numbers. If you're using Excel 2003, or later version, you can use the 100 series number, which ignore both filtered and manually hidden values.

在Excel帮助文件中,如果搜索SUBTOTAL,则会找到函数及其编号的表。 如果您使用的是Excel 2003或更高版本,则可以使用100系列编号,该编号将同时忽略过滤后的值和手动隐藏的值。

subtotalselect01

Copy that table to a sheet in the Excel workbook, and delete any functions that you don't need.

将该表复制到Excel工作簿中的工作表,然后删除不需要的任何功能。

subtotalselect02

Then, name the list of numbers, as FuncNum.

然后, 数字列表命名为FuncNum。

subtotalselect03

Name the list of function names, as FuncList.

将函数名称列表命名为FuncList。

subtotalselect04

创建功能下拉列表 (Create a Drop Down List of Functions)

On the sales order sheet, above the Excel table, create a drop down list of functions, by using a data validation list.

在Excel表格上方的销售订单表上,使用数据验证列表创建功能下拉列表。

subtotalselect05

Name the cell with the drop down list, as FunctionSel.

使用下拉列表将单元命名为FunctionSel。

subtotalselect06

查找功能编号 (Find the Function Number)

On the worksheet with the lists, we'll use the INDEX function to determine which function number was selected.

在带有列表的工作表上,我们将使用INDEX函数来确定选择了哪个函数号。

In cell E3, enter this INDEX function, to find the selected function name, and return the matching function number:

在单元格E3中,输入此INDEX函数,以找到选定的函数名称,并返回匹配的函数号:

=INDEX(FuncNum, MATCH(FunctionSel,FuncList,0))

= INDEX(FuncNum,MATCH(FunctionSel,FuncList,0))

subtotalselect07

Name the function number cell as FuncNumSel.

将功能编号单元命名为FuncNumSel。

subtotalselect08

创建小计公式 (Create the Subtotal Formulas)

In cell E2 on the sales order sheet, enter a subtotal function that uses the selected function number as its first argument.

在销售订单表的单元格E2中,输入将所选功能编号用作其第一个参数的小计功能。

=SUBTOTAL(FuncNumSel,SalesTable[Qty])

= SUBTOTAL(FuncNumSel,SalesTable [Qty])

If you're not using an Excel table, you could use a cell reference as the second argument, instead of the table reference.

如果您不使用Excel表,则可以使用单元格引用作为第二个参数,而不是表引用。

Copy the formula across to G2, and format the numbers, if necessary.

将公式复制到G2,并在必要时格式化数字。

subtotalselect09

Then, select a function name from the drop down list in cell C2, and the total cells will automatically change, to show the subtotal for the selected function.

然后,从单元格C2的下拉列表中选择一个功能名称,总单元格将自动更改,以显示所选功能的小计。

下载样本文件 (Download the Sample File)

To see the SUBTOTAL function, and the lists, you can download the Flexible Subtotal Function sample file.

要查看SUBTOTAL功能和列表,可以下载Flexible Subtotal Function示例文件

The file is in Excel 2007 format, and is zipped. There are no macros in the workbook.

该文件为Excel 2007格式,并且已压缩。 工作簿中没有宏。

视频:使用SUBTOTAL更改Excel函数 (Video: Change Excel Function With SUBTOTAL)

To see the steps for creating the interactive summary Subtotal formulas, and the drop down list, watch this short video tutorial.

要查看创建交互式汇总小计公式的步骤以及下拉列表,请观看此简短视频教程。

演示地址

翻译自: https://contexturesblog.com/archives/2011/03/14/change-excel-function-with-subtotal/

subtotal函数

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值