![](/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.