[英]rank function in vba syntax error
Range("AQ3").Formula = "=IF(ISNA(RANK(N3,Range("N3:N" & lastRow),0)),"",COUNTIF(Range("N3:N" & lastRow)" > "&N3)+1)"
Range("N3:N" & lastRow).filldown
Hi, for some reason I keep getting syntax error on the first line. 嗨,由于某种原因,我在第一行中不断收到语法错误。 I already defined last row in the previous section so there should be no error regarding that but i think it has to do something with general syntax.
我已经在上一节中定义了最后一行,因此应该没有错误,但是我认为它必须使用通用语法。 Can anyone help?
有人可以帮忙吗? Thanks
谢谢
It is because of "N3:N"
within the formula text. 这是因为公式文本中包含
"N3:N"
。 You haven't escaped the double quotes by using ""N3:N""
, for example. 例如,您没有使用
""N3:N""
来转义双引号。
There are general issues with the formula, however, which will stop this from working regardless. 但是,该公式存在一些一般性问题,无论如何都将阻止其正常工作。 What you will require instead:
您将需要什么:
Range("AQ3").Formula = "=IF(ISNA(RANK(N3,N3:N" & lastRow & ",0)),"""",COUNTIF(N3:N" & lastRow & ", "">$N3"")+1)"
Range("N3:N" & lastRow).FillDown
You might also need to fill down Range("AQ3:AQ" & lastRow)
– still, this won't throw a runtime error so long as lastRow is a valid integer. 您可能还需要填写
Range("AQ3:AQ" & lastRow)
–但是,只要lastRow是有效的整数,就不会抛出运行时错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.