简体   繁体   中英

Get value from a row that corresponds (in the same column) to a cell in another row

This is related to: excel function to get value of another cell (but slightly different)

I want to get the date (on Row D), that corresponds
to the last non-blank value in another row.
See below for what I am trying to describe.

  | 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

Asterisk (*) denotes a non-blank cell/value.

Can somebody please help me with the formula? Thanks.

在此处输入图片说明

Try this in $E$7. It's an array formula, so you have to hit ctrl+shift+enter.

=INDEX($A$2:$AF$2,1,MAX(IF(ISBLANK(L7:AF7),0,COLUMN(L7:AF7))))

If that works, you can copy and paste it to $E$11 and $E$15.

Formula in cell A1 =OFFSET(B1, 0, COUNTA(B1:F1) - 1)
Formula in cell A2 =OFFSET(B2, 0, COUNTA(B2:F2) - 1)

屏幕截图示例

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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