-2

The challenge here is the sentence is not split by cell. They are in the same column, but they might appear in the same cell. One sentence per line.

enter image description here

I need to count the occurrence of each sentence, for example, occurrence of "The cat is pink" is 2 and occurrence of "The dog is green" is 1.

I can also do Access 2016 if needed.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
Ice s. Woo
  • 27
  • 8
  • 2
    What have you tried so far? Are you looking for the number of occurrences of some sentences, or all of them? If the latter, do you have a list of unique sentences? What determines a new sentence within a cell, a carriage return? – cybernetic.nomad Aug 14 '18 at 18:10
  • I am looking for the number of occurrences of all of them. I do not have a list of unique sentences. A carriage return determines a new sentence. – Ice s. Woo Aug 14 '18 at 18:32

3 Answers3

1

(Assuming you can split multi-sentence cells into multiple cells)

1) Split the cells with multiple sentences, you should be able to adapt this code to do this.

2) Make a copy of the column (elsewhere on the same sheet or in another sheet -- used column B in the same sheet),

3) Remove duplicate values for the copied column

4) Next to the column use the following array formula:

{=SUM(LEN(A$1:A$5)-LEN(SUBSTITUTE(A$1:A$5,B1,"")))/LEN(B1)}

(press <CTRL><SHIFT><ENTER> when entering an array formula)

enter image description here

cybernetic.nomad
  • 6,100
  • 3
  • 18
  • 31
1

sort column A --> a-z then add a header to column A (to use in subtotals) then from the Data tab, use "subtotals" using "count" as the function

candice
  • 13
  • 4
0

=COUNTIF(A:A,"*Cat is Yellow*")

The same formula can be applied for all the rows.

Ramji
  • 375
  • 2
  • 14