简体   繁体   中英

MS Excel: Find Last Occurrence of Specific Text Across Multiple Columns in a List and Return Matching Cell Value

Using MS Excel (Not VBA), I would like a formula that searches across multiple Cells A2:D2 (and downward) to find and retrieve the last occurrence of a specific keyword found in a List "Keywords (Find What)" located in G2:G5. If last occurrence of keyword is found in either cells A2:D2, then extract/return the matching value of the content in Cell E2.

I've attempted to use this formula: =IFERROR(HLOOKUP(" "&G$5&" ",A2:D2,1,FALSE),""), Unfortunately it does not allow to search from a list, nor does it find the last occurrence.

See Illustration Example below for assistance:

在此处输入图像描述

You can use INDEX / AGGREGATE / SEARCH :

=IFERROR(INDEX(A2:D2,,AGGREGATE(14,6,COLUMN(A2:D2)/ISNUMBER(SEARCH(($G$2:$G$5),A2:D2)),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