Find a value in a range of cells as a substring

前端 未结 2 1822
梦如初夏
梦如初夏 2021-01-23 15:58

On tab 1, I have a column where each cell in that column has a group of numbers, and another column where that group of numbers is associated with a name. Example:

相关标签:
2条回答
  • 2021-01-23 16:40

    In order to achieve a true match, you must enforce the condition that each value looked for will begin and end with a comma. This string concatenation together with the wildcards will necessitate an array formula.

           INDEX(MATCH()) with wildcards

    The array formula in E1 is =INDEX('Tab 1'!$B$1:$B$4,MATCH("*,"&D1&",*",","&'Tab 1'!$A$1:$A$4&",",0)). This requires Ctrl+Shift+Enter rather than simply Enter. Once entered correctly, it can be filled down as necessary. You may wish to apply an IFERROR wrapper to show an empty string instead os #N/A.

    0 讨论(0)
  • 2021-01-23 16:47

    Entered as an array formula (Ctrl-Shift-Enter) and copied down, this works:

    =INDEX($B$1:$B$4,MATCH(TRUE,ISNUMBER(SEARCH(","&D8&",",","&$A$1:$A$4&",")),0))
    

    enter image description here

    0 讨论(0)
提交回复
热议问题