简体   繁体   English

Excel:从另一个添加行的工作表的单元格中引用一个公式

[英]Excel: Reference a formula in a cell from another worksheet where rows are added

help is appreciated on this topic! 感谢您提供有关此主题的帮助!

  • I am trying to reference cell B10 from Sheet2 to cell A1 in Sheet1. 我正在尝试将Sheet2中的单元格B10引用到Sheet1中的单元格A1中。
  • Cell B10 contains the formula SUM(B1:OFFSET(B10,-1,0)) , which sums values from B1:B9. 单元格B10包含公式SUM(B1:OFFSET(B10,-1,0)) ,该公式将B1:B9中的值相加。
  • Daily, I add a new row to Sheet2 such that the Column B range increases by +1, from B1:B9 to B1:B10, and the formula from B10 moves to B11. 每天,我向Sheet2添加一个新行,以使B列的范围从B1:B9到B1:B10增加+1,并且B10的公式移到B11。
  • I now need cell A1 in Sheet1 to reference cell B11 in Sheet2. 现在,我需要Sheet1中的单元格A1引用Sheet2中的单元格B11。

I've tried using offset() and indirect() but haven't figured this out. 我试过使用offset()和indirect(),但还没有弄清楚。

Thanks for help! 感谢帮助!

There are (at least) two ways to handle this: 有(至少)两种方法可以解决此问题:

1) Every time you insert the row, make sure you place your cursor on the formula cell before manually inserting row. 1)每次插入行时,请确保在手动插入行之前将光标放在公式单元格上。 If you do, the formula in Sheet1!A1 will automatically follow suit, and you can add whatever you need in the new cell (created from the new row). 如果这样做, Sheet1!A1的公式将自动跟随,您可以在新单元格(从新行创建)中添加所需的内容。 For example, inserting a row at B10 will adjust the formula in A1 to say =Sheet2!B11 . 例如,在B10处插入一行将调整A1的公式,使其表示=Sheet2!B11

2) Realizing that point 1 may not be suitable to your process, place this formula in Sheet1A1 : =OFFSET(Sheet2!B1,COUNT(Sheet2!B1:B100)-1,0) 2)意识到第1点可能不适合您的过程,请将此公式放在Sheet1A1=OFFSET(Sheet2!B1,COUNT(Sheet2!B1:B100)-1,0)
You can adjust the B100 to whatever you need. 您可以根据需要调整B100 Just be sure there's nothing in between the the final formula cell and the last row in the this formula range. 只要确保最终公式单元格与该公式范围的最后一行之间没有任何关系即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM