将特定单词移至单元格的开头

时间:2015-07-08 20:32:04

标签: excel if-statement text excel-formula move

我有大型电子表格,其中包含以下条目:

Alabama Men's Sport Bracelet Team Color Dial

对于每一个我需要将单词Men's移动到单元格中文本的前面。许多单元格包含单词Ladies而不是Men's,但需要相同的操作。

2 个答案:

答案 0 :(得分:0)

该公式假设文本位于单元格A1中,并且它会搜索确切的字符串“Men's”或“Ladies”:

=IF(ISNUMBER(SEARCH("Men's",A1)),"Men's "&" "&SUBSTITUTE(A1,"Men's",""), IF(ISNUMBER(SEARCH("Ladies",A1)),"Ladies "&" "&SUBSTITUTE(A1,"Ladies",""),A1))

答案 1 :(得分:0)

(略微)比@ rwilson更短的版本,但非常相似:

=IFERROR(IF(SEARCH("Men's",A1),"Men's "&SUBSTITUTE(A1,"Men's ","")),IFERROR(IF(SEARCH("Ladies",A1),"Ladies "&SUBSTITUTE(A1,"Ladies ","")),A1))