+ Reply to Thread
Results 1 to 16 of 16

Counting words

  1. #1
    Registered User
    Join Date
    01-17-2016
    Location
    Singapore
    MS-Off Ver
    Mac 2011
    Posts
    16

    Counting words

    Hi,

    I'm trying to find a way to calculate the number of words in each of the names listed in Column A, so I can sort the names based on word count.

    The formula I was given by a kind soul on another forum doesn't work. It gives errors and an incorrect count for certain names.

    =LEN(A2)-LEN(SUBSTITUTE(A2;" ";""))

    The semi-colon is used instead of a comma, which didn't work at all.

    This is a sample of the list:

    Haidan Zhong
    Haiqin Lao
    HaiYen Lim
    Hamilton Franco
    Hamish Jonathan Hay
    HanBin Tan
    Handi Ajimasta
    Handian Lo
    HangWei Low
    Hanjie Lee
    HanKit Lin
    HanLei Chong
    HanLing Tan
    HanMing Huang
    Hanna Katerina Tantoco
    Hannah Claire Day
    Hannah YinLai Leong
    HanQuan Luo
    HanTang Wai
    Hanwei Tan
    HanXiang Sng

    Any ideas how to show the word count in column B, so I can sort them (names with two words first, then three words, and so on)?

    Thanks.

  2. #2
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Counting words

    You need to add +1

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  3. #3
    Registered User
    Join Date
    01-17-2016
    Location
    Singapore
    MS-Off Ver
    Mac 2011
    Posts
    16

    Re: Counting words

    Thanks. Even when I added +1, it gave errors. On the last row, for example, a red arrow was pointing to an empty cell. Am using Excel Mac 2011. Is that the problem?

  4. #4
    Registered User
    Join Date
    01-17-2016
    Location
    Singapore
    MS-Off Ver
    Mac 2011
    Posts
    16

    Re: Counting words

    About the formula with commas, it doesn't work at all.

  5. #5
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Counting words

    ...or another variation as an array formula entered with Ctrl Shift Enter

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  6. #6
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Counting words

    Quote Originally Posted by NoBob View Post
    the formula with commas, it doesn't work
    That's just a regional settings thing.
    Some regions use semicolon ( ; ) as a list separator instead of commas.
    So anytime someone suggests a formula, and they use commas, you just need to change them to semicolons.

    The formula works just fine for me.

    Can you attach a sample workbook?
    Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic

  7. #7
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Counting words

    When you say there is incorrect count can you explain why? Are you considering words like 'HanXiang Sng' as 3 or two? If it is 3 words then use this formula:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    v A B
    1 Names Count
    2 Haidan Zhong 2
    3 Haiqin Lao 2
    4 HaiYen Lim 3
    5 Hamilton Franco 2
    6 Hamish Jonathan Hay 3
    7 HanBin Tan 3
    8 Handi Ajimasta 2
    9 Handian Lo 2
    10 HangWei Low 3
    11 Hanjie Lee 2
    12 HanKit Lin 3
    13 HanLei Chong 3
    14 HanLing Tan 3
    15 HanMing Huang 3
    16 Hanna Katerina Tantoco 3
    17 Hannah Claire Day 3
    18 Hannah YinLai Leong 3
    19 HanQuan Luo 3
    20 HanTang Wai 3
    21 Hanwei Tan 2
    22 HanXiang Sng 3
    Last edited by AlKey; 01-17-2016 at 09:44 PM.

  8. #8
    Registered User
    Join Date
    01-17-2016
    Location
    Singapore
    MS-Off Ver
    Mac 2011
    Posts
    16

    Re: Counting words

    Hi,

    This is driving me mad! I just get an "you typed an error" when I use =SUM(IF(MID(A5;ROW($1:$50);1)=" “;1,0))+1

    and the same with =IF(A2<>"",COUNT(AGGREGATE(14,6,FIND(CHAR(ROW(INDIRECT("65:90"))),A2,2),{1,2,3,4,5}))+1,"")

    I want to treat 'HanXiang Sng' as two words.

    Workbook1.xlsx

  9. #9
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Counting words

    You were already given all kind of formulas that work.

    Please see attached file.
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    01-17-2016
    Location
    Singapore
    MS-Off Ver
    Mac 2011
    Posts
    16

    Re: Counting words

    Okay,

    I tried =IF(A2<>"",COUNT(AGGREGATE(14,6,FIND(CHAR(ROW(INDIRECT("65:90"))),A2,2),{1,2,3,4,5}))+1,"") in Windows Excel 2013, and it works, but it doesn't work in Mac Excel 2011.

    I can't get =SUM(IF(MID(A5;ROW($1:$50);1)=" ";1,0))+1 to work in Windows Excel 2013 either. I still get an error.

    About the formula =IF(A2<>"",COUNT(AGGREGATE(14,6,FIND(CHAR(ROW(INDIRECT("65:90"))),A2,2),{1,2,3,4,5}))+1,""), how do I get 'HanXiang Sng', 'HanLei Chong' and 'HanLing Tan' to show as two words?

    Thanks.

  11. #11
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,937

    Re: Counting words

    Try

    B2=SUMPRODUCT((MID(A2,ROW(1:86),1)=" ")*1)+1 and drag down.

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    If I helped, Don't forget to add reputation (click on the little star ★ at bottom of this post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)

  12. #12
    Registered User
    Join Date
    01-17-2016
    Location
    Singapore
    MS-Off Ver
    Mac 2011
    Posts
    16

    Re: Counting words

    Thanks, but =SUMPRODUCT((MID(A2,ROW(1:86),1)=" ")*1)+1 doesn't seem to work in either Mac Excel 2011 or Windows Excel 2013. Names like 'HangWei Low', 'HanLing Tan' and 'Hannah Claire Day' all show as 1, but 'Hamish Jonathan Hay' as 3, and 'Haiqin Lao' as 2.

  13. #13
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,937

    Re: Counting words

    Oh!!! I forget to lock the cells

    Try

    =SUMPRODUCT((MID(A2,ROW($1:$86),1)=" ")*1)+1

  14. #14
    Registered User
    Join Date
    01-17-2016
    Location
    Singapore
    MS-Off Ver
    Mac 2011
    Posts
    16

    Re: Counting words

    That works! Thanks!

  15. #15
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Counting words

    Quote Originally Posted by NoBob View Post
    That works! Thanks!
    Did you look at post#9?

  16. #16
    Registered User
    Join Date
    01-17-2016
    Location
    Singapore
    MS-Off Ver
    Mac 2011
    Posts
    16

    Re: Counting words

    Quote Originally Posted by AlKey View Post
    You were already given all kind of formulas that work.

    Please see attached file.
    Thanks. Yes, I thought I'd just posted a message about that (is there an icon for scratching head and thinking where did my reply disappear to?). =IF(A2="","",LEN(A2)-LEN(SUBSTITUTE(A2," ",""))+1) works, too. Thank you.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 03-02-2021, 07:33 PM
  2. Counting words
    By burnsie in forum Excel General
    Replies: 1
    Last Post: 10-15-2015, 11:37 AM
  3. [SOLVED] Counting Words
    By corn1991 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-18-2015, 09:09 AM
  4. [SOLVED] counting words
    By makinmomb in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-01-2015, 07:47 AM
  5. counting words
    By Duckie in forum Excel General
    Replies: 2
    Last Post: 01-18-2010, 07:28 PM
  6. Counting words............
    By Smokey_Vol in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 12-21-2005, 11:35 AM
  7. Counting words
    By johanl in forum Excel General
    Replies: 1
    Last Post: 07-30-2005, 06:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1