简体   繁体   中英

Excel - Get value of a column in a row where match found in another column

在此处输入图片说明

I need to track where value in J column starts appearing zero. In following table, its 7th row. From this row, I need to get value of D column to appear in some designated Cell outside this table. In this case it would be 11 y, 2 m .

I used offset function, that gives me first occurrence of zero in J column. But I'm not sure how to lookup different column ( D ) from the same row to fetch it's value.

My formula: =OFFSET(J1,MATCH(0,J:J,0)-1,0)

Here actual data starts at first row; hence 1 is used above. It correctly returns first zero (0) occurrence in J column.

Assuming the column is sorted so that the first zero is the only zero that matters, one of many solutions is Index Match.

=Index(D:D,Match(0,J:J,0))

Index returns the value of nth position in a list. Match returns the position of the of the first match in a list; the 0 at the end is a parameter to specify an exact match. When both lists are the same length, such as two columns in a table, then you use Match to find the index and use Index to find the value of an arbitrary column.

So, in this example, Match returns 7. The 7th position in Column D is 11y, 2m

In the very near future (or right now for some people) you will be able to use XLookup to do the same thing.

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