excel中如何提取符合要求的字符
发布网友
发布时间:2022-02-27 12:35
我来回答
共3个回答
热心网友
时间:2022-02-27 14:05
=IF(ISERROR(FIND("桃子",A2)),IF(ISERROR(FIND("西瓜",A2)),IF(ISERROR(FIND("芒果",A2)),0,"芒果"),"西瓜"),"桃子")
热心网友
时间:2022-02-27 15:23
如果B1中的逗号是全角状态的,B2中输入
=IF(SUMPRODUCT(COUNTIF(A2,"*"&TRIM(MID(SUBSTITUTE(B$1,",",REPT(" ",99)),ROW(INDIRECT("1:"&LEN(B$1)-LEN(SUBSTITUTE(B$1,",",))+1))*99-98,99))&"*")),INDEX(TRIM(MID(SUBSTITUTE(B$1,",",REPT(" ",99)),ROW(INDIRECT("1:"&LEN(B$1)-LEN(SUBSTITUTE(B$1,",",))+1))*99-98,99)),SUMPRODUCT(COUNTIF(A2,"*"&TRIM(MID(SUBSTITUTE(B$1,",",REPT(" ",99)),ROW(INDIRECT("1:"&LEN(B$1)-LEN(SUBSTITUTE(B$1,",",))+1))*99-98,99))&"*")*ROW(INDIRECT("1:"&LEN(B$1)-LEN(SUBSTITUTE(B$1,",",))+1)))),0)
下拉。就可以了。
由于B1中水果品种不定,每个品种字数也不定,所以公式就比较繁琐。
热心网友
时间:2022-02-27 16:57
楼上两位回答的 都只能是 A列中只存在一个关键字 如果存在多个且顺序和B1的不一样,那么结果也会错误,LZ如果A列里只会存在一个关键字,那么都可用,不然存在多个的话只能VBA