使用单元格值作为公式中表格的参考 [英] Using cell value as reference to sheet in formulas

查看:73
本文介绍了使用单元格值作为公式中表格的参考的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含三张纸的电子表格。其中两个分别称为 2012 2011 ,它们具有类似的数据。最后一张纸做数据之间的比较。

I have a spreadsheet with three sheets. Two are called 2012 and 2011 and have a bunch of similar data. The last sheet does comparisons between the data.

为了能够选择年份,我使用一个单元格(D1),我可以在其中写入 2011 2012 。然后,公式使用INDIRECT函数将此单元格包括为参考的一部分。

To be able to choose year, I'm using a cell (D1) where I can I can write either 2011 or 2012. The formulas then use the INDIRECT function to include this cell as part of the reference.

INDIRECT(CHAR(39)&$D$1&CHAR(39)&"!F:F")

这不是一个漂亮的解决方案,并且会使公式变得冗长而复杂。

This is not a pretty solution and makes the formula quite long and complex.

=IFERROR(SUM(FILTER( INDIRECT(CHAR(39)&$D$1&CHAR(39)&"!M:M") ;  (INDIRECT(CHAR(39)&$D$1&CHAR(39)&"!B:B")=$A4)+(INDIRECT(CHAR(39)&$D$1&CHAR(39)&"!B:B")=$A5)+(INDIRECT(CHAR(39)&$D$1&CHAR(39)&"!B:B")=$A6)+(INDIRECT(CHAR(39)&$D$1&CHAR(39)&"!B:B")=$A7)+(INDIRECT(CHAR(39)&$D$1&CHAR(39)&"!B:B")=$A8); MONTH(INDIRECT(CHAR(39)&$D$1&CHAR(39)&"!D:D"))=$B$1 ; INDIRECT(CHAR(39)&$D$1&CHAR(39)&"!F:F")=D$3));0)

是否有更好的方法?

我尝试为计算表和导入创建单独的电子表格(IMPORTRANGE )使用VMERGE(脚本库中的自定义功能)将两张纸上的数据放在一起ry),但这两张表中有很多数据,并且导入需要很长时间。任何变化(例如变化的年份)也需要很长时间才能重新计算。

I've tried to create a separate spreadsheet for the calculations sheet and importing (IMPORTRANGE) the data from the two sheets together on one sheet with VMERGE (custom function from the script gallery) but there is quite a lot of of data in these two sheets and the import takes a long time. Any changes (like changing year) also take a long time to recalculate.

推荐答案

这样做时,数据库函数通常会更干净的东西。

Database functions tend to be cleaner when doing this kind of thing.

https://support.google.com/docs/bin/static.py?hl=zh_CN&topic=25273&page=table.cs&tab=1368827

数据库功能需要一段时间才能学习,但是功能强大。

Database functions take a while to learn, but they are powerful.

您可以将INDIRECT(CHAR(39)& $ D $ 1& CHAR(39)&!B:B)放在一个单元格中。

You could put INDIRECT(CHAR(39)&$D$1&CHAR(39)&"!B:B") in a cell on its own.

这篇关于使用单元格值作为公式中表格的参考的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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