Counting multiple values within single cells

T

Terry Bennett

Is there a way I can do this?

I have a spreadsheet with a list of branches in cells A1 - A300. I then
have columns of data for each of the past 5 years (ie; B - F) and want to
count the number of instances where particular items occur in each column
(ie; 'apples' or 'oranges', etc). The difficulty is that in some cells
there is more than one item shown ... eg: cell C10 may have 'apples' and
'oranges' - the data is entered this way using 'Alt+Enter' to delimit the 2
items as I don't want rows with empty cells.

Is there a way of counting the items even though they are not in separate
cells? Or is there a better way of approaching this?

Many thanks.
 
B

Bernard Liengme

Use =COUNTIF(B1:B500,"*apples*")
This worked for me with "apples pears" in one cell with LF (linefeed)
between the two words.
best wishes
 
T

Terry Bennett

Thanks Bernard - that partially works. It seems to count the number of
instances of cells that contain the word in question. What I really need is
something that will actually count the number of those words in the whole
column (sometimes the same word can occur twice within a cell).
 
G

Guest

This appeared to work for me (counting the number of occurrences of apple in
a1:a8 where sometimes apple occurred more than once in a cell:

=SUMPRODUCT((LEN(A1:A8)-LEN(SUBSTITUTE(A1:A8,"apples","")))/LEN("apples"))
 
T

Terry Bennett

Thanks Kevin - that seems to work well!

Kevin Vaughn said:
This appeared to work for me (counting the number of occurrences of apple
in
a1:a8 where sometimes apple occurred more than once in a cell:

=SUMPRODUCT((LEN(A1:A8)-LEN(SUBSTITUTE(A1:A8,"apples","")))/LEN("apples"))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top