adding up words

ttowncorp

Board Regular
Joined
Feb 2, 2015
Messages
180
Office Version
  1. 365
Platform
  1. Windows
is there a way to add up words in a sentence in excel? for example in A1 I have "the cow jumped over the moon" and in cell A2 I have " but the cow and the cat had a milk moon pie". and I wanted to add up how many times the word "cow" or "moon" are typed in my sentence's.

moonthecow
the cow jumped over the moon242
but the cow and the cat had a milk moon pie

<tbody>
</tbody>
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

CalcSux78

Well-known Member
Joined
Oct 15, 2013
Messages
1,120
Not sure if you're familiar with vba dictionaries, but seems like the perfect function for your dilemma.
 
Upvote 0

Gilles1

New Member
Joined
May 27, 2016
Messages
9
You could try using the countif formula.

=COUNTIF(column, "*searchword*")


The searchword has to be between the asterisks
 
Last edited:
Upvote 0

jlhoover3

Board Regular
Joined
Nov 9, 2015
Messages
55
Office Version
  1. 365
Platform
  1. Windows
Column AColumn BColumn CColumn D
the cow jumped over the moonmoonthecow
but the cow and the cat had a milk moon pie242

<tbody>
</tbody>
=SUMPRODUCT((LEN($A$1:$A$2)-LEN(SUBSTITUTE($A$1:$A$2,C1,"")))/LEN(C1))
=SUMPRODUCT((LEN($A$1:$A$2)-LEN(SUBSTITUTE($A$1:$A$2,D1,"")))/LEN(D1))
=SUMPRODUCT((LEN($A$1:$A$2)-LEN(SUBSTITUTE($A$1:$A$2,E1,"")))/LEN(E1))
 
Upvote 0

FDibbins

Well-known Member
Joined
Feb 16, 2013
Messages
6,723
Try this...
=SUMPRODUCT(LEN($A$2:$A$3)-LEN(SUBSTITUTE($A$2:$A$3,B$1,"")))/LEN(B$1)
copied across
 
Upvote 0

Weazel

Well-known Member
Joined
Dec 24, 2011
Messages
3,155
I'm not following why you're putting the range into the substitute if you're only evaluating 1 row at a time.

unless I'm missing something

Excel 2013
ABCD
1moonthecow
2the cow jumped over the moon121
3but the cow and the cat had a milk moon pie121

<tbody>
</tbody>
Sheet5

Worksheet Formulas
CellFormula
B2=(LEN($A2)-LEN(SUBSTITUTE($A2,B$1,"")))/LEN(B$1)

<tbody>
</tbody>

<tbody>
</tbody>
 
Upvote 0

Gilles1

New Member
Joined
May 27, 2016
Messages
9
I tried it myself and sadly it doesn't work when the same word is in the cell twice (this formula only counts the cells).

But FDibbins came up with the solution that works well :

=SUMPRODUCT((LEN(A:A)-LEN(SUBSTITUTE(UPPER(A:A),UPPER(B1),"")))/LEN(B1))


The upper in the formula accounts for the difference in upper and lower case entries of the same word

this works perfect. thank you
 
Last edited:
Upvote 0

Forum statistics

Threads
1,191,025
Messages
5,984,201
Members
439,877
Latest member
kellylet

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top