简体   繁体   中英

Finding occurences of string in Excel

I have a column in Excel filled with non uniform data and I need to find the occurrences of strings within it.

Example table:

http://is.gd/RGvXND

Using =COUNTIF(A:A, " "&B2&" ") would work, with the exception of "Apple", which appears twice in the same cell.

How do you overcome this problem?

How many duplicates can you have? Use the following formula, updating the row 10 to your maximum number of duplicates. Enter using Ctrl + Shift + Enter as this is an array formula.

=SUM(COUNTIF($A$2:$A$7,REPT("*"&$B2&*",ROW($1:$10))))

这是另一个公式选项,但是如果有大量数据,它可能会变慢

=SUMPRODUCT(LEN(A$2:A$10)-LEN(SUBSTITUTE(A$2:A$10,B2,"")))/LEN(B2)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM