[英]Using INDIRECT() with INDEX() function
I have a formula which I am hoping to build on to be able to drag down to auto complete for a number of rows. 我有一个公式,希望可以将其向下拖动以自动完成许多行。
=COUNTA(INDEX(1:100,0,ROW(A1)))
The aim of this formula is to count the number of non blank cells in each of my columns. 此公式的目的是计算我每列中非空白单元的数量。 I am aware that I could use another formula...
我知道我可以使用其他公式...
=COUNTA(EIM!A$1:A$100)
... and drag this across, paste special values and then paste special transpose it, but I was wondering if there was another (more elegant) way. ...并将其拖移,粘贴特殊值,然后粘贴特殊转置,但是我想知道是否还有另一种(更优雅的)方式。 As you can see in the second formula, I am tring to pull the values of another worksheet.
正如您在第二个公式中看到的那样,我正试图提取另一个工作表的值。 Therefore, I was thinking INDIRECT() being the way to go.
因此,我认为INDIRECT()是必经之路。
My question is: How can I use INDIRECT() to combine with my first formula that uses the INDEX() function to make this happen? 我的问题是:如何使用INDIRECT()结合使用INDEX()函数的第一个公式来实现此目的?
Below is a screenshot of current formula as it evaluates (not sure if it helps): 以下是当前公式计算时的屏幕截图(不确定是否有帮助):
Sure you could , but should you? 当然可以 ,但是应该吗?
To do it, you'd use R1C1 style, by specifying false
in indirect: 为此,您可以通过间接指定
false
来使用R1C1样式:
=COUNTA(INDIRECT("EIM!R1C"&ROW(A1)&":R100C"&ROW(A1),FALSE))
or just: 要不就:
=COUNTA(INDEX(INDIRECT("EIM!$1:$100"),0,ROW(A1)))
Often, if you're using INDIRECT you're doing something wrong. 通常,如果您使用的是INDIRECT,则说明您做错了什么。 The only reasonable use-cases for indirect I've seen are (a) choosing another worksheet by formula (for which there is no good way in Excel) and (b) writing an Excel tutorial example that references a named cell.
我所看到的唯一合理的间接用例是(a)通过公式选择另一个工作表(在Excel中没有好的方法),以及(b)编写一个引用命名单元格的Excel教程示例。
If you are always referencing a particular worksheet, you'd use: 如果您始终引用特定的工作表,则可以使用:
=COUNTA(INDEX(EIM!$1:$100,0,ROW(A1)))
If each column represents a different worksheet, then indirect might be acceptable. 如果每一列代表一个不同的工作表,则间接的是可以接受的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.