如何用另一个单元格锁定动态生成的单元格的内容
how to lock content of a dynamically generated cell with another cell
背景
我喜欢用 story mapping to gather requirements from clients (and to create estimates for them) using cardboardit.com. I'm currently making a sample estimate for a project that I have completed in the past (http://vibereel.com/)。
Cardboardit 提供了将数据转储到 csv 文件的功能,可以在 this sheet
的 data
选项卡中以原始格式保存
数据选项卡非常原始,所以我使用此公式使其在 estimate
选项卡中看起来更漂亮:
=QUERY(data!A2:J,"select C,E,D where A='card' and E<>'white' order by I,J label C 'name', E 'color', D 'notes' ",0)
然后我要求工程师在行中填写估计值。工程师在其他两栏(front end和backend)下填写估算值..
问题
问题是当我意识到我遗漏了用户地图中的一些元素时。所以我调整了用户图,再次导出数据并转储到data
sheet。考虑到上面的公式很聪明,estimate
sheet 会立即准确地更新。
然而,问题是工程师输入的值现在与新值不一致。即一个名为 "edit vibereel" 的前端任务以前估计为 1 天,但是一旦输入新数据.. 那个放错地方了
问题
我该怎么做才能做到
- 每当工程师在两列下输入一个值时,这些值就会 锁定 ,或 link 锁定它们最初在 name
列下执行的任务。
备选问题
解决这个问题的另一种方法是每次更改数据 sheet(由于用户映射的更改).. 新数据集可以转储到新数据 sheet (即data-v2),并且可以创建另一个估计sheet(即estimate-v2)。这将具有商业意义,因为它向客户展示了估算值的变化。在这种情况下,如何简单地将估算值从 estimate
复制并粘贴到 estimate-v2
并且仍然是 link他们到适当的估计?
可能的解决方案
它太大了,无法 post 单独回答,但计划是:
- 再创建一个 'help' 选项卡来存储数据。
- 通过 ID 连接当前标签和 'help' 标签。您的示例中的 ID 是 A 列:名称。使用
ArrayFormula
+ vlookup
使其动态更新。
- make script
onEdit
: 在当前选项卡中编辑目标列时→读取值→清除单元格→将值粘贴到'help'选项卡中。并且公式将返回正确的值。
我已经在我的项目中实现了这一点。缺点是您必须等待大约 0.5 秒。当您编辑单元格时,脚本是 运行。
我做了sample sheet,你可以试试
简答
无法将手动输入的值直接锁定到公式结果行。而是使用 backend/frontend 架构类型。
宽泛的说明
后端 table。创建一个sheet来作为一个"mirror"的Cardboard吧!数据和工程师输入的关于价差的估计sheet(一个后端,两个前端)
1.1 备选方案1:使用脚本更新两个来源的数据值。
1.2 备选方案 2:使用公式连接来自两个来源的数据值。
前端工作区。使用此 sheet 进行时间估算的手动数据输入。
2.1为了更方便的保持数据同步,包含来自Cardboard的id吧! CSV 文件(假设这是一个永久 ID)
- 2.1.1 您可以隐藏此列以保持当前布局的外观。
2.2 后台传数据table
- 2.2.1 如果您继续使用公式,"freeze" 数据以防止手动输入的估计数据仅通过复制和粘贴值而错位。这可以通过使用 UI 命令、键盘快捷键或脚本来完成。
备注
如果您将在会议上使用传播sheet,我认为 time-driven 触发器或自定义菜单比编辑触发器更好,因为 运行 避免在会议期间分心的脚本。
如果您想保留修订,请在每次导入 CSV 文件或召开估算审查会议时复制一份价差sheet。将副本保留为修订快照并继续处理原始文件。这是因为 Google 表格修订历史可能包含太多细节,无法轻松跳转到主要修订,但如果您需要进行详细的历史修订,可能会有所帮助。
稍后您可以使用 IMPORTRANGE 将所有修订估计放在一起,即制作一个估计随时间变化的图表。
基于公式的实现示例。
起点
假设您有两个价差sheet
- 数据:它保存从第一次导出到 CSV 文件的数据。
- 估计:它包含屏幕截图上显示的布局。
第 1 步
将 id 值添加到估计中 sheet。假设它作为 D 列插入。
第 2 步
在 Cardboard it! 上对纸板进行更改后,下载并导入一个新的 CSV 文件,假设这个新 sheet 名为 data-v2。为简单起见,在此示例中,它被添加到相同的价差 sheet.
第 3 步
将以下公式添加到data-v2!L1
=ArrayFormula(ARRAY_CONSTRAIN({{"frontend","backend"};IFERROR(VLOOKUP(B2:B,{'estimate-v1'!D:D,'estimate-v1'!E:F},{2,3},FALSE()),)},counta(A:A),2000000))
注释公式
=ArrayFormula( // Tells Google Sheets that non array functions should work as array
functions and that the result should be expanded to the required area (rows/columns)
ARRAY_CONSTRAIN( // Limit results to the required number of rows.
{ // Starts a new array
{"frontend","backend"}; // Array with the column headers
IFERROR( // In case of error will return a blank
VLOOKUP(
B2:B, // Range with the values look for.
{'estimate-v1'!D:D,'estimate-v1'!E:F}, // Array. This is my preferred notation considering
that that the ID column could be moved in the future, but at this time it could be replaced
by 'estimate-v1'!D:F
{2,3}, // This makes that VLOOKUP returns a array with two columns. The first column is
filled up with values from the second column, the column is filled up with values from the
third column.
FALSE() // This tells VLOOKUP that the second argument is not sorted.
),)
},
counta(A:A), // This limits the resulting rows to those that are required (discards blank
rows)
2000000 // A big number (it's the maximun number of cells)
))
第 4 步
- 为新的估算审核创建一个新的 sheet。
将以下公式添加到A1
=QUERY('data-v2'!A2:M,"select C,E,D,B,L,M where A='card' and E<>'white' order by I,J
label C 'name', E 'color', D 'notes', B 'id', L 'front end', M 'backend' ",0)
Select全部,复制并粘贴为值。
- 应用格式和公式计算估算总计。
硬纸板啦! CSV headers
- 种类
- id
- 姓名
- 描述
- 颜色
- 状态
- 尺寸
- 注释
- x
- y
- image_url
另见
参考资料
背景
我喜欢用 story mapping to gather requirements from clients (and to create estimates for them) using cardboardit.com. I'm currently making a sample estimate for a project that I have completed in the past (http://vibereel.com/)。
Cardboardit 提供了将数据转储到 csv 文件的功能,可以在 this sheet
的data
选项卡中以原始格式保存
数据选项卡非常原始,所以我使用此公式使其在 estimate
选项卡中看起来更漂亮:
=QUERY(data!A2:J,"select C,E,D where A='card' and E<>'white' order by I,J label C 'name', E 'color', D 'notes' ",0)
然后我要求工程师在行中填写估计值。工程师在其他两栏(front end和backend)下填写估算值..
问题
问题是当我意识到我遗漏了用户地图中的一些元素时。所以我调整了用户图,再次导出数据并转储到data
sheet。考虑到上面的公式很聪明,estimate
sheet 会立即准确地更新。
然而,问题是工程师输入的值现在与新值不一致。即一个名为 "edit vibereel" 的前端任务以前估计为 1 天,但是一旦输入新数据.. 那个放错地方了
问题
我该怎么做才能做到
- 每当工程师在两列下输入一个值时,这些值就会 锁定 ,或 link 锁定它们最初在 name
列下执行的任务。
备选问题
解决这个问题的另一种方法是每次更改数据 sheet(由于用户映射的更改).. 新数据集可以转储到新数据 sheet (即data-v2),并且可以创建另一个估计sheet(即estimate-v2)。这将具有商业意义,因为它向客户展示了估算值的变化。在这种情况下,如何简单地将估算值从 estimate
复制并粘贴到 estimate-v2
并且仍然是 link他们到适当的估计?
可能的解决方案
它太大了,无法 post 单独回答,但计划是:
- 再创建一个 'help' 选项卡来存储数据。
- 通过 ID 连接当前标签和 'help' 标签。您的示例中的 ID 是 A 列:名称。使用
ArrayFormula
+vlookup
使其动态更新。 - make script
onEdit
: 在当前选项卡中编辑目标列时→读取值→清除单元格→将值粘贴到'help'选项卡中。并且公式将返回正确的值。
我已经在我的项目中实现了这一点。缺点是您必须等待大约 0.5 秒。当您编辑单元格时,脚本是 运行。
我做了sample sheet,你可以试试
简答
无法将手动输入的值直接锁定到公式结果行。而是使用 backend/frontend 架构类型。
宽泛的说明
后端 table。创建一个sheet来作为一个"mirror"的Cardboard吧!数据和工程师输入的关于价差的估计sheet(一个后端,两个前端)
1.1 备选方案1:使用脚本更新两个来源的数据值。
1.2 备选方案 2:使用公式连接来自两个来源的数据值。前端工作区。使用此 sheet 进行时间估算的手动数据输入。
2.1为了更方便的保持数据同步,包含来自Cardboard的id吧! CSV 文件(假设这是一个永久 ID)
- 2.1.1 您可以隐藏此列以保持当前布局的外观。
2.2 后台传数据table
- 2.2.1 如果您继续使用公式,"freeze" 数据以防止手动输入的估计数据仅通过复制和粘贴值而错位。这可以通过使用 UI 命令、键盘快捷键或脚本来完成。
备注
如果您将在会议上使用传播sheet,我认为 time-driven 触发器或自定义菜单比编辑触发器更好,因为 运行 避免在会议期间分心的脚本。
如果您想保留修订,请在每次导入 CSV 文件或召开估算审查会议时复制一份价差sheet。将副本保留为修订快照并继续处理原始文件。这是因为 Google 表格修订历史可能包含太多细节,无法轻松跳转到主要修订,但如果您需要进行详细的历史修订,可能会有所帮助。
稍后您可以使用 IMPORTRANGE 将所有修订估计放在一起,即制作一个估计随时间变化的图表。
基于公式的实现示例。
起点
假设您有两个价差sheet - 数据:它保存从第一次导出到 CSV 文件的数据。 - 估计:它包含屏幕截图上显示的布局。
第 1 步
将 id 值添加到估计中 sheet。假设它作为 D 列插入。
第 2 步
在 Cardboard it! 上对纸板进行更改后,下载并导入一个新的 CSV 文件,假设这个新 sheet 名为 data-v2。为简单起见,在此示例中,它被添加到相同的价差 sheet.
第 3 步
将以下公式添加到data-v2!L1
=ArrayFormula(ARRAY_CONSTRAIN({{"frontend","backend"};IFERROR(VLOOKUP(B2:B,{'estimate-v1'!D:D,'estimate-v1'!E:F},{2,3},FALSE()),)},counta(A:A),2000000))
注释公式
=ArrayFormula( // Tells Google Sheets that non array functions should work as array
functions and that the result should be expanded to the required area (rows/columns)
ARRAY_CONSTRAIN( // Limit results to the required number of rows.
{ // Starts a new array
{"frontend","backend"}; // Array with the column headers
IFERROR( // In case of error will return a blank
VLOOKUP(
B2:B, // Range with the values look for.
{'estimate-v1'!D:D,'estimate-v1'!E:F}, // Array. This is my preferred notation considering
that that the ID column could be moved in the future, but at this time it could be replaced
by 'estimate-v1'!D:F
{2,3}, // This makes that VLOOKUP returns a array with two columns. The first column is
filled up with values from the second column, the column is filled up with values from the
third column.
FALSE() // This tells VLOOKUP that the second argument is not sorted.
),)
},
counta(A:A), // This limits the resulting rows to those that are required (discards blank
rows)
2000000 // A big number (it's the maximun number of cells)
))
第 4 步
- 为新的估算审核创建一个新的 sheet。
将以下公式添加到A1
=QUERY('data-v2'!A2:M,"select C,E,D,B,L,M where A='card' and E<>'white' order by I,J label C 'name', E 'color', D 'notes', B 'id', L 'front end', M 'backend' ",0)
Select全部,复制并粘贴为值。
- 应用格式和公式计算估算总计。
硬纸板啦! CSV headers
- 种类
- id
- 姓名
- 描述
- 颜色
- 状态
- 尺寸
- 注释
- x
- y
- image_url