In Google Sheets return all cells that contain string

百般思念 提交于 2019-12-24 08:05:36

问题


I've seen a lot of similar questions where users want to returns all rows that contain a specific value, but I'd like to only return the cells that contain the value.

Basically, I have one sheet that has a bunch of categories in different cells, on the second sheet I'd like to return every category that contains a "_". I tried =QUERY(cat!A:Z,"select * where B contains '_'"), but that returns the whole row, I just want every cell individually.

Thanks for any suggestions!


回答1:


Try this one:

=TRANSPOSE(SPLIT( ARRAYFORMULA(CONCATENATE(IF(REGEXMATCH(Sheet1!A:Z,"_"),Sheet1!A:Z&"~",""))) ,"~"))

You may use some rare symbol, like ~ to join and split the result, so it shows in one single line.

Data sample

Result



来源:https://stackoverflow.com/questions/41021841/in-google-sheets-return-all-cells-that-contain-string

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