Excel技巧-动态引用其他Sheet中的内容

本文讲述了如何根据单元格内容为参数动态引用Excel其他单元格中的内容,这些单元格可能是同一个sheet,也可以是不同的sheet。

主要使用了两个函数:

Address 用来动态生成单元格地址。

  • Syntax ADDRESS(row_num,column_num,abs_num,a1,sheet_text) Row_num is the row number to use in the cell reference. Column_num is the column number to use in the cell reference. Abs_num specifies the type of reference to return. A1 is a logical value that specifies the A1 or R1C1 reference style. If a1 is TRUE or omitted, ADDRESS returns an A1-style reference; if FALSE, ADDRESS returns an R1C1-style reference. Sheet_text is text specifying the name of the worksheet to be used as the external reference. If sheet_text is omitted, no sheet name is used.

Indirect用来根据指定字符串获得单元格内容。

  • Syntax INDIRECT(ref_text,a1) Ref_text is a reference to a cell that contains an A1-style reference, an R1C1-style reference, a name defined as a reference, or a reference to a cell as a text string. If ref_text is not a valid cell reference, INDIRECT returns the #REF! error value.

    • If ref_text refers to another workbook (an external reference), the other workbook must be open. If the source workbook is not open, INDIRECT returns the #REF! error value.
    A1 is a logical value that specifies what type of reference is contained in the cell ref_text.
    • If a1 is TRUE or omitted, ref_text is interpreted as an A1-style reference.
    • If a1 is FALSE, ref_text is interpreted as an R1C1-style reference.

 


举例:

场景是这样的,有多个项目,每个项目的信息放在一个sheet中,sheet名字就是项目名称,例如:PJ1/PJ2/PJ3。还有一个sheet(Total)汇总所有的信息。

工作量159
  

我们希望当增加或删除一个项目时,操作尽可能简单。

可以看到每个项目sheet的A2单元格保存了项目工作量数据。

在total sheet中,目前有三列,从左到右:

  • 项目名称,也就是sheet名称
  • 单元格地址串:其中sheet名称是根据同一行第一列的内容动态变化的。这一列纯粹为了演示用。
它的内容是 =ADDRESS(1, 2, 1, TRUE, Ax)其中最后一个参数指定了项目名单元格,每行不同。这样,就得到了一系列的地址字符串PJ1!$B$1 / PJ2!$B$1 / PJ3!$B$1
  • 单元格内容:对应项目的工作量。 内容为 =INDIRECT( ADDRESS(1, 2, 1, TRUE, Ax) ),把单元格地址转化为单元格引用。
最后的结果如下:
Project NameCell AddressCell Value by cell address
PJ1PJ1!$B$1100
PJ2PJ2!$B$1200
PJ3PJ3!$B$1300

如果增加一个项目,拷贝一行新的内容,然后,把第一列的名字改成新sheet的名称就可以了。如果想从不同的sheet中获得不同单元格的内容,也可以不address的其他参数改称对单元格的引用 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值