简体   繁体   English

使用列号的Excel公式范围参考

[英]excel formula range reference using column number

I'm looking for a way to use the column number that I get from MATCH in a range reference. 我正在寻找一种使用在范围引用中从MATCH获得的列号的方法。 I need to count the number of X's in this row, up to a specific point. 我需要计算该行中X的数量,直到特定点为止。 Here's some code as an example of what I'm trying to get to work. 这里有一些代码作为我要开始工作的示例。

=COUNTIF($A$14:MATCH($E$1| $A$13:$V$13)$14|"X")

I need to use MATCH (or something equivalent), as it lets me know the number of columns I need to count across. 我需要使用MATCH(或等效的东西),因为它使我知道需要计数的列数。 Users may or may not remember to clear out the whole row past this number of columns even though it should only count, say, 10 columns' worth of X's in this row. 用户可能会记得或可能不会记得清除超出此列数的整行,即使该行仅应计算该行中10列X的值。 I already know exactly how many columns to count due to other data on the sheet (referenced as $E$1 in match) that matches a number in the check row, so something along these lines is a preferable solution. 我已经确切地知道要归因于工作表上与检查行中的数字匹配的其他数据(匹配中称为$ E $ 1)而要计数的列,因此采用这些方法是更可取的解决方案。

You can use INDEX with MATCH to get the end of your range, eg 您可以将INDEXMATCH结合使用以获取范围的终点,例如

=COUNTIF($A$14:INDEX($14:$14,MATCH($E$1,$A$13:$V$13)),"X")

So if the MATCH function gives you 10, for example, that will count "x"s in A14:J14 因此,例如,如果MATCH函数为您提供10,则它将在A14:J14中计为“ x”

Note that if you want an exact MATCH you need zero as third argument of MATCH function (I haven't included that) 请注意,如果您想要一个精确的MATCH,则需要零作为MATCH函数的第三个参数(我没有提供该参数)

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM