![](/img/trans.png)
[英]How to get VBA code to check if cell value matches column heading and return value from another cell in the same row?
[英]Get value from a row that corresponds (in the same column) to a cell in another row
这涉及到: excel函数获取另一个单元格的值 (但略有不同)
我想获取日期(在D行上),该日期对应
到另一行中的最后一个非空白值。
请参阅下文,了解我要描述的内容。
| D2 | D3 | D4 | D5 <- Dates
-------------------------
A | X2 | X3* | X4* | X5 <- A should get D4, X4 is the last non-blank value
B | Y2* | Y3* | Y4* | Y5* <- B should get D5, Y5 is the last non-blank value
星号(*)表示非空白的单元格/值。
有人可以帮我提供配方吗? 谢谢。
试试$ E $ 7。 这是一个数组公式,因此您必须按ctrl + shift + enter。
= INDEX($ A $ 2:$ AF $ 2,1,MAX(IF(ISBLANK(L7:AF7),0,COLUMN(L7:AF7)))))
如果可行,您可以将其复制并粘贴到$ E $ 11和$ E $ 15。
单元格A1中的公式=OFFSET(B1, 0, COUNTA(B1:F1) - 1)
单元格A2中的公式=OFFSET(B2, 0, COUNTA(B2:F2) - 1)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.