+ Reply to Thread
Results 1 to 11 of 11

Count the number of first letters derived from words in a row

  1. #1
    Forum Contributor
    Join Date
    05-16-2007
    Location
    USA
    MS-Off Ver
    MS Office 2016, Excel 2016
    Posts
    214

    Count the number of first letters derived from words in a row

    I can use the following formula to accomplish what I need, but it is not very efficient, as I have to type a formula for every letter from A-Z, whether that letter is even used.

    Please Login or Register  to view this content.
    I would prefer to do it dynamically, so it would only count the letters that are present. The count of the letters are derived from the first letter of every word within a row.

    So, if cells A1, B1, C1 equal blue, green, black, respectively, then the count would be G=1 and B=2. That means one word was found that starts with the letter 'G' and two words were found that start with the letter 'B'.

    The range is G4:BB4 and each roll down to G126:BB126. I assume this will require an array formula.


    Hope that makes sense!

  2. #2
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Count the number of first letters derived from words in a row

    Here's one option:

    =CHAR(ROWS($1:65))&"="&SUMPRODUCT(--(UPPER(LEFT(G$126:BB$126))=CHAR(ROWS($1:65))))

    Drag the formula down the column.

  3. #3
    Forum Contributor
    Join Date
    05-16-2007
    Location
    USA
    MS-Off Ver
    MS Office 2016, Excel 2016
    Posts
    214

    Re: Count the number of first letters derived from words in a row

    This looks promising, thank you! I was trying to figure out why it wasn't counting, and then I realized you had set it for row G126:BB126.

    Also, using the formula as is, I can only get the count for one letter, which is 'A'. You mentioned to use the fill down, but that is the wrong way for the words, as they are listed horizontally in each row, so I need it to fill to the right. I tried to drag it to the right, but the results were wrong.

    But other than that, that was a quick suggestion and appears to be on the right track. Thank you, again!
    Last edited by AliGW; 06-08-2019 at 11:48 AM. Reason: Please don't quote unnecessarily!

  4. #4
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Count the number of first letters derived from words in a row

    Sorry, I was in a rush when I sent that.

    The formula was built to work for one row and be dragged down from A=# to Z=#.

    If you have multiple rows and want to drag the formula to the right, you can use this instead:
    BD4 =CHAR(COLUMNS($A:BM))&"="&SUMPRODUCT(--(UPPER(LEFT($G4:$BB4))=CHAR(COLUMNS($A:BM))))

    Drag the formula to the right.

    This will give you A to Z with the counts each in a different cell.

  5. #5
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,577

    Re: Count the number of first letters derived from words in a row

    Try anyone of the below. Pl see file.

    =COUNTIF($A$3:$A$8,B4&"*")

    =COUNTIF($A$3:$A$8,CHAR(ROW(97:97))&"*")

    drag down below.
    Attached Files Attached Files
    Last edited by kvsrinivasamurthy; 06-08-2019 at 03:04 AM.
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  6. #6
    Forum Contributor
    Join Date
    05-16-2007
    Location
    USA
    MS-Off Ver
    MS Office 2016, Excel 2016
    Posts
    214

    Re: Count the number of first letters derived from words in a row

    Quote Originally Posted by 63falcondude View Post
    Sorry, I was in a rush when I sent that.

    ...
    This works great, thank you for updating it!
    Last edited by AliGW; 06-08-2019 at 11:49 AM.

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,288

    Re: Count the number of first letters derived from words in a row

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  8. #8
    Forum Contributor
    Join Date
    05-16-2007
    Location
    USA
    MS-Off Ver
    MS Office 2016, Excel 2016
    Posts
    214

    Re: Count the number of first letters derived from words in a row

    Quote Originally Posted by AliGW View Post
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.
    Actually, I have a follow up question.

    I really need to sort the results based on the count of each letter found since many of the letters count's equal 0 and are not essential. So basically all the letters that equal zero are sorted to the right or further out, while the letters with a higher count are displayed to the left. Not sure if it's possible to sort them as is, since each cell result is labeled as an example: A=3, B=1, C=2, D=0. I would assume I need them to show the count first followed by the "=" then letter, like 3=A, 1=B, 2=C, 0=D. Then it would be easier to sort them I assume.

    Any thoughts?

    Edit: Actually, it looks like you can't even sort horizontally in Excel. Is this correct?
    Last edited by Modify_inc; 06-08-2019 at 12:13 PM.

  9. #9
    Forum Contributor
    Join Date
    05-16-2007
    Location
    USA
    MS-Off Ver
    MS Office 2016, Excel 2016
    Posts
    214

    Re: Count the number of first letters derived from words in a row

    Quote Originally Posted by 63falcondude View Post
    Sorry, I was in a rush when I sent that.

    The formula was built to work for one row and be dragged down from A=# to Z=#.

    If you have multiple rows and want to drag the formula to the right, you can use this instead:
    BD4 =CHAR(COLUMNS($A:BM))&"="&SUMPRODUCT(--(UPPER(LEFT($G4:$BB4))=CHAR(COLUMNS($A:BM))))

    Drag the formula to the right.

    This will give you A to Z with the counts each in a different cell.
    I have a follow up question, if you don't mind.

    I really need to sort the results based on the count of each letter found since many of the letters count's equal 0 and are not essential. So basically all the letters that equal zero are sorted to the right or further out, while the letters with a higher count are displayed to the left. Not sure if it's possible to sort them as is, since each cell result is labeled as an example: A=3, B=1, C=2, D=0. I would assume I need them to show the count first followed by the "=" then letter, like 3=A, 1=B, 2=C, 0=D. Then it would be easier to sort them I assume.

    Well, it looks like you can't sort horizontally in Excel.

    It would be great if I could convert the range of results, which is G1:BB1, to a dropdown list and have the results sorted as I mentioned earlier, with the higher counts at the top.

  10. #10
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,288

    Re: Count the number of first letters derived from words in a row

    Yes, you can sort horizontally, but this is a very different question, so please start a new thread for it. It is to do with sorting, not counting, so your new thread will need an appropriate title. Thanks.

  11. #11
    Forum Contributor
    Join Date
    05-16-2007
    Location
    USA
    MS-Off Ver
    MS Office 2016, Excel 2016
    Posts
    214

    Re: Count the number of first letters derived from words in a row

    Quote Originally Posted by AliGW View Post
    Yes, you can sort horizontally, but this is a very different question, so please start a new thread for it. It is to do with sorting, not counting, so your new thread will need an appropriate title. Thanks.
    Ok, I figured it out after some additional testing. I will mark this thread as Solved.

+ 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: 05-18-2018, 06:38 AM
  2. [SOLVED] How to count a cell with letters and number
    By RachaelE in forum Excel General
    Replies: 5
    Last Post: 03-27-2015, 06:18 AM
  3. Count letters/words
    By PhilS5 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-03-2014, 05:06 PM
  4. Replies: 5
    Last Post: 09-02-2014, 03:49 PM
  5. [SOLVED] i need a number total derived from words
    By greenlion in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-01-2006, 03:10 PM
  6. count number of letters in a string
    By Wiley in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 05-11-2006, 01:50 PM
  7. [SOLVED] How do you sort words in Excel by the number of letters in a word
    By Kinger in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 05-02-2005, 07:06 PM

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