Average sentence length in a string

knenok

New Member
Joined
Oct 30, 2018
Messages
6
Say I have the text, "There was no fire alarm. There were no sprinklers or fire escapes. And when a band member tried to put out a fire that had been started by pyrotechnics, the extinguisher didn't work." in cell A1 and need to calculate the average sentence length for that cell. I tried =AVERAGE(LEN(A2)-LEN(SUBSTITUTE(A2," ",""))+1) but it returned "33", not 11.
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Welcome to the Board!

I am not sure what you think the "AVERAGE" function is doing here. All you are doing is counting the number of spaces. But you are not counting or dividing by the number of sentences.
You would need to count the periods and divide by them, i.e.
Code:
=(LEN(A2)-LEN(SUBSTITUTE(A2," ",""))+1)/(LEN(A2)-LEN(SUBSTITUTE(A2,".","")))
Note that this works for your example, but if you have other punctuation other than periods (like ! or ?), you would need to count those too.
 
Upvote 0

Forum statistics

Threads
1,214,987
Messages
6,122,613
Members
449,090
Latest member
vivek chauhan

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
Back
Top