If a particular word exists within a field then assign corresponding value from a table“legend”

寵の児 提交于 2019-12-11 09:22:34

问题


Reference Spreadsheet >> Spreadsheet - I need a formula in column B that searches through column A for text values that exist in the legend (column E), then if text is found, assign corresponding value that exists in column F.

The alternative for this is to use a formula, but instead of this, I want to use a table that I can modify rather than modifying the formula each time I need to update values. This is the formula I currently have

=IF(ISNUMBER(SEARCH("First",A3)),"One",(IF(ISNUMBER(SEARCH("Second",A3)),"Two",(IF(ISNUMBER(SEARCH("Third",A3)),"Three",(IF(ISNUMBER(SEARCH("Fourth",A3)),"Four",(IF(ISNUMBER(SEARCH("Fifth",A3)),"Five")))))))))


回答1:


Confirmed with ctrl+shift+enter

=INDEX($F$2:$F$20,MATCH(MIN(IFERROR(SEARCH(OFFSET($E$2,,,COUNTA($E$2:$E$20)),A2),LEN(A2))),SEARCH(OFFSET($E$2,,,COUNTA($E$2:$E$20)),A2),0))



回答2:


Alternate without CSE or the volatile OFFSET function.

In B3 as,

=IFERROR(INDEX(F:F, AGGREGATE(15, 6, ROW(E$3:INDEX(E:E, MATCH("zzz", E:E)))/ISNUMBER(SEARCH(E$3:INDEX(E:E, MATCH("zzz", E:E)), A3)), 1)), "")

Fill down as necessary.

For a case-sensitive lookup, change SEARCH to FIND.




回答3:


Late answer...

=LOOKUP(2^15,SEARCH($E$3:$E$8,A3),$F$3:$F$8)



来源:https://stackoverflow.com/questions/42752496/if-a-particular-word-exists-within-a-field-then-assign-corresponding-value-from

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!