简体   繁体   English

FormulaR1C1的这行是什么意思?

[英]What does this line of FormulaR1C1 mean?

I get what FormulaR1C1 means from this link . 我从此链接了解FormulaR1C1的含义。
But I couldn't get it when it was used with an ampersand & in VBA and Vlookup here in this line: 但是在以下行中将其与&符&在VBA和Vlookup中使用时,我无法获得它:

.Range(Cells(2, 3), Cells(2, 79)).FormulaR1C1 = "=VLOOKUP(RC1&R1C,POR_Vert!C4:C6,3,FALSE)"

RC1 translates to this row , column 1. R1C translates to row 1, this column . RC1转换为第一R1C转换为第一行, 此列

So if you're writing this formula to cells(2,3) (which is $C$2 ) then it is interpreted as: 因此,如果您将此公式写到cells(2,3)(即$C$2 ),那么它将被解释为:

"=VLOOKUP($A2 & C$1,POR_Vert!$D:$F,3,FALSE)"

So, for example, if $A2 contains "Searc" and C$1 contains "hKey" then it would be the equivalent of: 因此,例如,如果$ A2包含“ Searc”,而C $ 1包含“ hKey”,则它等效于:

"=VLOOKUP(RC1 & R1C,POR_Vert!C4:C6,3,FALSE)"         'becomes..
"=VLOOKUP($A2 & C$1,POR_Vert!$D:$F,3,FALSE)"         'becomes..
"=VLOOKUP("Searc" & "hKey",POR_Vert!$D:$F,3,FALSE)"  'becomes..
"=VLOOKUP("SearchKey",POR_Vert!$D:$F,3,FALSE)"

& is the concatenation operator so the lookup value is column A of the current row with row 1 of the current column appended to it. &是连接运算符,因此查找值是当前行的A列,并附加了当前列的1行。 So in C2, you are taking the value of A2 and appending C1 to the end, then looking up the result. 因此,在C2中,您要获取A2的值并将C1附加到末尾,然后查找结果。

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

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