简体   繁体   English

Google Spreadsheet中的公式可显示另一个单元格中一个单元格的值,其中单元格之间的列数是受控变量?

[英]Formula in Google Spreadsheet to display the value of one cell in another cell where the number of columns between the cells is a controlled variable?

How do I create a formula in Google Spreadsheet which will display the value of one cell (eg cell A2) in another cell (eg C3) where the number of columns between the cells (n) is a controlled variable (in this example "2")? 如何在Google Spreadsheet中创建一个公式,该公式将显示另一个单元格(例如C3)中一个单元格(例如,单元格A2)的值,其中单元格之间的列数(n)是受控变量(在本示例中为“ 2 ”)?

Use case: I have a cash-flow model broken down by weeks in columns and want to show revenue 'n' number of weeks after deal has been signed, where I can manipulate one cell (representing the value of 'n') to see the impact on the model. 用例:我有一个按周细分的现金流量模型,并希望在签署交易后的几周内显示收入“ n”,我可以在其中操纵一个单元格(表示“ n”的值)来查看对模型的影响。

You use INDIRECT for this. 您为此使用INDIRECT

=INDIRECT("A"&n)

Where n is your variable. 其中n是您的变量。 So, if n = 2 , you get A2 . 因此,如果n = 2 ,则得到A2 If n = 3 , you get A3 . 如果n = 3 ,则得到A3

EDIT: To reflect the change I made in the spreadsheet, here's the formula I used instead: 编辑:为了反映我在电子表格中所做的更改,这是我改为使用的公式:

=IFERROR(INDEX(6:6,1,COLUMN()-$B$14-1)*$B$13,0)

I had a similar issue when working on a character spreadsheet and the solution I got was to use offset. 在处理字符电子表格时,我遇到了类似的问题,而我得到的解决方案是使用偏移量。 The format is =offset(a,b,c) where a stands for the cell you want as your placeholder, in your example it would be a2. 格式为= offset(a,b,c),其中a代表您要用作占位符的单元格,在您的示例中为a2。 where b contains the value which will be moved over for rows (I actually have it targeting another cell so when I "level up" I can just change one box and everything dependent on it updates). 其中b包含将移至行的值(实际上,我将其定位到另一个单元格,因此当我“升级”时,我可以只更改一个框,所有依赖于它的内容都会更新)。 Where c contains the value to move over in columns. 其中c包含要在列中移动的值。 https://support.google.com/docs/answer/3093379?hl=en https://support.google.com/docs/answer/3093379?hl=zh_CN

暂无
暂无

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

相关问题 Google电子表格公式引用的单元格具有另一个单元格的地址 - Google spreadsheet formula refer to cell with address to another cell 从单元格获取值并使用其引用另一个电子表格中单元格的公式? - Formula to grab value from a cell and use that to refer to a cell in another spreadsheet? 根据单元格中的值将行的一部分从一个 Google 电子表格复制到另一个 Google 电子表格? - Copying part of a row from one Google spreadsheet to another google spreadsheet based on a value in a cell? 在单元格中记录/编号一个公式,不要删除谷歌电子表格 - appscript - Record / number a formula in a cell, not to be deleted google spreadsheet - appscript 如何在另一个单元格中使用写为字符串的公式[评估 Google 电子表格] - How to use a formula written as a string in another cell [evaluate for Google Spreadsheet] 在电子表格中,我想将具有负值的单元格复制到另一个具有负值下限的单元格中 - In a spreadsheet, I want to copy cells with a negative value onto another cell where there is a floor for negative values Google Sheets (Formula) - 如果一个单元格等于某个值,它将返回另一个值到相邻单元格 - Google Sheets (Formula) - If one cell equals some value, it will return another value to a neighboring cell Google Spreadsheet-如果另一个单元格包含N个字符串之一,则求和单元格值 - Google Spreadsheet - Sum cell value if another cell contain one of N strings 来自另一个单元格值的 Google 电子表格单元格引用 - Google spreadsheet cell reference from value of another cell 谷歌表格; 在行号为 > 另一个公式中生成的行号的列中查找第一个包含 0 的单元格 - Google Sheets; Finding the first cell to contain 0 in a column where the row number is > the row number generated in another formula
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM