Explanation

For each cell in the range, SUBSTITUTE removes all spaces from the text, then LEN calculates the length of the text without spaces. This number is then subtracted from the length of the text with spaces, and the number 1 is added to the final result, since the number of words is the number of spaces + 1. We’re using TRIM to remove any extra spaces between words, or at the beginning or end of the text.

The result of all this calculation is a list of items, where there is one item per cell in the range, and each item a number based on the calculation above. In other words, we have a list of word counts, with one word count per cell.

SUMPRODUCT then sums this list and returns a total for all cells in the range.

Note that the formula inside SUMPRODUCT will return 1 even if a cell is empty. If you need to guard against this problem, you can add another array to SUMPRODUCT as below. The double hyphen coerces the result to 1’s and 0’s. We use TRIM again to make sure we don’t count cells that have one or more spaces.

=SUMPRODUCT((LEN(TRIM(B3:B7))-LEN(SUBSTITUTE(B3:B7," ",""))+1),--(TRIM(B3:B7)<>""))

Explanation

To include double quotes inside a formula, you can use additional double quotes as escape characters . By escaping a character, you are telling Excel to treat the " character as literal text. You’ll also need to include double quotes wherever you would normally in a formula.

For example, if cell A1 contains the text: The Graduate and you want wrap that text inside double quotes (""), you can use this formula:

=""""&A1&""""

Because the text on either side of A1 consists of only of a double quote, you need """" . The outer quotes (1 & 4) tell Excel this is text, the 2nd quote tells Excel to escape the next character, and the 3rd quote is displayed.

If you want to add the movie to other text to create, you can concatenate the movie title inside double quotes with a formula like this:

="The 1960's movie """ &A1&""" is famous"

The result: The 1960’s movie “The Graduate” is famous

Working with extra double quotes can get confusing fast, so another way to do the same thing is to use the CHAR function with the number 34:

="The 1960's movie "&CHAR(34)&A1&CHAR(34)&" is famous"

In this case, CHAR(34) returns the double quote character (") which is included in the result as literal text.

CHAR is handy for adding other text that is hard to work with in a formula as well. You can use CHAR(10) to insert a line break character into a formula on Windows. On a Mac, use CHAR(13):

=CHAR(10) // win line break
=CHAR(13) // mac line break