获取给定行号和列号的单元格的内容 [英] Get content of a cell given the row and column numbers
问题描述
我想获取给定行号和列号的单元格的内容.行号和列号存储在单元格中(此处为 B1、B2).我知道以下解决方案有效,但它们感觉有点笨拙.
I want to get the content of a cell given its row and column number. The row and column number are stored in cells (here B1,B2). I know the following solutions work, but they feel a bit hacky.
溶胶 1
=CELL("contents",INDIRECT(ADDRESS(B1,B2)))
溶胶 2
=CELL("contents",OFFSET($A$1, B1-1,B2-1))
有没有更详细的方法?(比如 =CellValue(row,col) 或其他什么)?
Is there no less verbose method? (like =CellValue(row,col) or whatever)?
编辑/澄清:我只想使用excel工作表公式.没有 VBA.简而言之,我几乎在寻找与 VBA Cells() 方法等效的 Excel 公式.
Edit / Clarification: I just want to use the excel worksheet formulas. No VBA. In short, I pretty much look for the equivalent of the VBA Cells() method as an excel Formula.
推荐答案
您不需要公式的 CELL() 部分:
You don't need the CELL() part of your formulas:
=INDIRECT(ADDRESS(B1,B2))
或
=OFFSET($A$1, B1-1,B2-1)
两者都可以.请注意,INDIRECT
和 OFFSET
都是易失性函数.易失性函数会减慢计算速度,因为它们会在每次重新计算时进行计算.
will both work. Note that both INDIRECT
and OFFSET
are volatile functions. Volatile functions can slow down calculation because they are calculated at every single recalculation.
这篇关于获取给定行号和列号的单元格的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!