Excel 电子表格使用 table 个值覆盖单元格
Excel spreadsheet to overwrite cells using a table of values
我想编写一个 excel 函数,它将用 table 中的值替换一些包含文本的单元格。单元格中的文本对应于 table.
例如:
这里有我想要 replace/overwrite 的细胞。我想使用 Table of values for matching
将我的 text1_1
与 Table of values for replacement
中的 newtext
匹配到 (1,1),依此类推。
我怎样才能做到这一点?
虽然我做了以下事情:
- 我知道
text1_1
在 cell to replace
table 的第 1 列中。
- 所以,我知道
text1_1
将在 Table of values for matching
的第一行,我只需要在那里找到该列。
- 曾经,我在
Table of values for matching
中有行号r和列号c,然后我可以使用该值at Table of values for replacement
at (r - displacement, c) 替换我的 text1_1
in Cells to replace
.
有可能存在比我想象的更有效的解决方案,所以在那种情况下,我非常愿意看到它。
我应该使用哪些功能?如果没有直接的方法,那么有人可以给我一些指导吗?
假设我正确理解你的问题,这是一个建议。
如评论中所述,无法将公式放置在将使用同一单元格内容的单元格中,因为它已经包含公式。您可以 做的是创建一个新的table 以根据Table of values for matching
提取所有新 值。但是,我在这里(使用您的示例)假设您知道在 table 中查看的列/行。在您的示例中,cell to replace
的列号是 Table of values for matching
中要查看的行号,因此我的解决方案适合这种情况。不过,您可以轻松地对其进行编辑以满足其他需要,只要您现在在哪一列/行中查找即可。那么让我们开始吧:
- 创建一个新的 table,大小与
cell to replace
table 相匹配。
- 在最左上角的单元格中粘贴以下公式:
=INDEX($G:$M,A,MATCH(A3,OFFSET($G:$M,A-1,0),0))
- 将此公式拖到所有其他单元格,您将看到与
Table of values for replacement
中的值匹配的新值
如果它回答了您的问题,请告诉我 ;)
我想编写一个 excel 函数,它将用 table 中的值替换一些包含文本的单元格。单元格中的文本对应于 table.
例如:
这里有我想要 replace/overwrite 的细胞。我想使用 Table of values for matching
将我的 text1_1
与 Table of values for replacement
中的 newtext
匹配到 (1,1),依此类推。
我怎样才能做到这一点?
虽然我做了以下事情:
- 我知道
text1_1
在cell to replace
table 的第 1 列中。 - 所以,我知道
text1_1
将在Table of values for matching
的第一行,我只需要在那里找到该列。 - 曾经,我在
Table of values for matching
中有行号r和列号c,然后我可以使用该值atTable of values for replacement
at (r - displacement, c) 替换我的text1_1
inCells to replace
.
有可能存在比我想象的更有效的解决方案,所以在那种情况下,我非常愿意看到它。
我应该使用哪些功能?如果没有直接的方法,那么有人可以给我一些指导吗?
假设我正确理解你的问题,这是一个建议。
如评论中所述,无法将公式放置在将使用同一单元格内容的单元格中,因为它已经包含公式。您可以 做的是创建一个新的table 以根据Table of values for matching
提取所有新 值。但是,我在这里(使用您的示例)假设您知道在 table 中查看的列/行。在您的示例中,cell to replace
的列号是 Table of values for matching
中要查看的行号,因此我的解决方案适合这种情况。不过,您可以轻松地对其进行编辑以满足其他需要,只要您现在在哪一列/行中查找即可。那么让我们开始吧:
- 创建一个新的 table,大小与
cell to replace
table 相匹配。 - 在最左上角的单元格中粘贴以下公式:
=INDEX($G:$M,A,MATCH(A3,OFFSET($G:$M,A-1,0),0))
- 将此公式拖到所有其他单元格,您将看到与
Table of values for replacement
中的值匹配的新值
如果它回答了您的问题,请告诉我 ;)