You are here:

- Home
- Computing/Technology
- Business Software
- Excel
- Counting letters in cells

Advertisement

QUESTION: If I have cells such as A1 to A31 and have several different letters in each, such as b v c k a w b c k w and wanted lets say to get a count on just the b's in that range, what would I use as a formula?

Thanks

ANSWER: =COUNTIF(A1:A31,"b")

---------- FOLLOW-UP ----------

QUESTION: I tried this and I received the error: ERR:508

What I'm attempting to do is type in several different letters into a single cell and later I will need to count all the B's then Count all the E's, etc. in each cell in a column. Such as B,D,E,R. Into one cell.

I'm at a total loss of what to do.

Thank you.

That's different from you first said. Try this formula

=SUM(LEN(A11:A31)-LEN(SUBSTITUTE(A1:A31,"B","")))

DO NOT press enter to enter the formula. If you do you will get the wrong answer. This is an array formula. Press CONTROL SHIFT ENTER to enter it. After you do so the formula will look like this in the formula bar

{=SUM(LEN(A21:A28)-LEN(SUBSTITUTE(A21:A28,"a","")))}

Excel puts the french braces {} around the formula when you press CNTL SHIFT ENTER

Maybe this will help

Bill

This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here

Excel

Answers by Expert:

I can provide help with most all EXCEL questions and most all questions about writing EXCEL macros. I have been developing macros for about 10 years in EXCEL and have switched to it from Lotus 1-2-3 after about 10 years of writing macros in it. Typically, I will not write a macro for you unless it is very short because of all the details a macro has to know about to work every time and all the time are rarely provided. If I am not given ALL the details, circumstances, and situations then a "good" macro can not be written. Please understand that I do not know it all and will be the first to say so. As politely as possible, I don't write macros for people on this site who need one, want one, seem to imply that they need one, and/or seem to think I am expected to write one UNLESS they are very short, quick, and simple. 99% of all macros are more involved than what you think and rarely am I provided with enough specific and complete details to have the code work the first time and every time. This typically means too many follow-up emails, and subsequent macro changes due to lack of specific details, just to get those details so that the macro would work, all of which is on my own free time. The voice of experience from responding to many questions from people who ask me to write a macro for them from this site tells me this. I don't mean to come across as unhelpful but macros are usually very specific and without ALL of the specifics the macro I would write will not address all of your needs and the layout, location, formatting, conditions, etc. of your data and any related files the macro would have to work with. What seems like a simple task to you is almost always more involved than what you think to have the macro ALWAYS work in EVERY situation. If you have a macro you have already written and have a question about it then perhaps I could help with that. I am sure and hope you can and do understand.