我有一个大栏目,每行都有句子。
如果句子包含特定单词,我想一个接一个地返回句子列表。 例如,在下面的文本中,即一列,我想复制整个单元格,如果它包含" hath " 。
Whan that aprill with his shoures soote
The droghte of march hath perced to the roote,
And bathed every veyne in swich licour
Of which vertu engendred is the flour;
Whan zephirus eek with his sweete breeth
Inspired hath in every holt and heeth
Tendre croppes, and the yonge sonne
Hath in the ram his halve cours yronne,
And smale foweles maken melodye,
That slepen al the nyght with open ye
(so priketh hem nature in hir corages);
Thanne longen folk to goon on pilgrimages,
And palmeres for to seken straunge strondes,
To ferne halwes, kowthe in sondry londes;
And specially from every shires ende
Of engelond to caunterbury they wende,
The hooly blisful martir for to seke,
That hem hath holpen whan that they were seeke.
谢谢很多人
答案 0 :(得分:1)
使用过滤器或VBA更容易,但如果你必须有一个公式,你可以试试这个:
B1: =IF(IFERROR(SEARCH("hath",A1),FALSE),A1,"")
B2: =CONCATENATE(B1,IF(IFERROR(SEARCH("hath",A2),FALSE),A2,""))
选择B2并填写B800。 B800将包含您的连锁句子。
如果您想在每个句子之间显示换行符,请尝试:
B2: =CONCATENATE(B1,IF(B1<>CONCATENATE(B1,IF(IFERROR(SEARCH("hath",A2),FALSE),A2,"")),CHAR(10),""),IF(IFERROR(SEARCH("hath",A2),FALSE),A2,""))
请记得打开自动换行,您可能需要更改字体大小才能看到所有字符。
但请记住,根据连接中的字符数,您可能会遇到单元格内容限制的长度。