fbpx
Search
Close this search box.

Convert Text to Sentence Case using Excel Formulas [Quick Tips]

Share

Facebook
Twitter
LinkedIn

It is almost 3:30 am now, I stayed awake for last 23 hours so that Excel School 2 can be ready for rolling. But that is no excuse for not having a post here. So here it goes.

Excel has formulas for converting a bunch of text to UPPER, lower and Proper Cases. But not a formula to convert o Sentence case. So, today we will learn a simple formula tip to convert text to sentence case (ie, First letter capital).

Convert to Sentence Case - Excel Formulas

Assuming your text is in C2, the formula is,

=UPPER(LEFT(C2,1))&MID(LOWER(C2),2,999)

How the formula works?

It is converting first letter of C2 to upper case [UPPER(LEFT(C2,1))] and lower case of rest of C2 [MID(LOWER(C2),2,999)]

The 999 portion is the secret code to unlock ninja features of MID formula.

Well, I am kidding of course, the 999 is just a cop-out to say give me rest of the C2, I don’t know the length of it. (of course, 999 would fail if your text actually has more than 1000 chars. In that case, just use 9999 or whatever large number you fancy.)

Another formula:

=SUBSTITUTE(LOWER(C2),CHAR(CODE(C2)),UPPER(CHAR(CODE(C2))),1)

PS: As you can guess, the above formulas assume that C2 has one sentence. If C2 has a whole paragraph, then I would really need a sandwich before thinking about that problem.

How do you convert cases using Excel?

Please share your tips using comments.

Read a quick tip, become awesome in excel in less than 5 seconds.

Facebook
Twitter
LinkedIn

Share this tip with your colleagues

Excel and Power BI tips - Chandoo.org Newsletter

Get FREE Excel + Power BI Tips

Simple, fun and useful emails, once per week.

Learn & be awesome.

Welcome to Chandoo.org

Thank you so much for visiting. My aim is to make you awesome in Excel & Power BI. I do this by sharing videos, tips, examples and downloads on this website. There are more than 1,000 pages with all things Excel, Power BI, Dashboards & VBA here. Go ahead and spend few minutes to be AWESOME.

Read my storyFREE Excel tips book

Excel School made me great at work.
5/5

– Brenda

Excel formula list - 100+ examples and howto guide for you

From simple to complex, there is a formula for every occasion. Check out the list now.

Calendars, invoices, trackers and much more. All free, fun and fantastic.

Advanced Pivot Table tricks

Power Query, Data model, DAX, Filters, Slicers, Conditional formats and beautiful charts. It's all here.

Still on fence about Power BI? In this getting started guide, learn what is Power BI, how to get it and how to create your first report from scratch.

letter grades from test scores in Excel

How to convert test scores to letter grades in Excel?

We can use Excel’s LOOKUP function to quickly convert exam or test scores to letter grades like A+ or F. In this article, let me explain the process and necessary formulas. I will also share a technique to calculate letter grades from test scores using percentiles.

27 Responses to “Convert Text to Sentence Case using Excel Formulas [Quick Tips]”

  1. Gerald Higgins says:

    Interesting post. I can't think of a neat way to get a single formula to produce initial sentence capitals for an indefinite number of sentences contained in a single cell (but I bet SOMEONE can).

    As a workaround, if you actually had this situation - i.e. lots of multi-sentence paragraphs, with each paragraph in a cell of its own - then what you could do is use text to columns to isolate each sentence into a cell of its own, and apply your formula to each single-sentence cell.
    Then, if you really wanted to, you could string all the sentences back into one single paragraph cell. BUT, once you have split them up, you would probably be better off keeping all the sentences separate.

  2. John McEwan says:

    You could use LEN(C2)-1 for the length of the text string minus the first character. That's better then trying to fudge it with a large numeral.

  3. Andy Wall says:

    =UPPER(LEFT(C2,1))&LOWER(RIGHT(C2,LEN(C2)-1)) will get rid of the 999 variable.

  4. Andy Wall says:

    OK Had a quick think about multiple sentences. Using PROPER and SUBSTITUTE gives an answer (I think. I haven't tested fully)

    =SUBSTITUTE(SUBSTITUTE(PROPER(SUBSTITUTE(SUBSTITUTE(LOWER(C12),". ","9z9")," ","zxz")),"9Z9",". "),"zxz"," ")

    PROPER capitalizes first letter in a string and any letters that follow any character other than letter. So we use substitute to build the logic (using strings that can be replaced ie not common combinations.

    Sorry it's a bit garbled. Give it a try. Write multiple sentences in C12

  5. Gregor Erbach says:

    In principle, this is difficult to do for *all* sentences because Excel has no recursion or regular expressions. You could use VBA, or export the sentences to a text file and process them with your favourive regular expression language.

    If you really need to do this in Excel (and assuming that all sentences end with a period followed by a blank), you find the first period followed by a blank, substitute that by a placeholder (I used "#"), and uppercase the letter after that.

    The following example assumes that the original text is in C2.

    =SUBSTITUTE(C2,". "&MID(C2,SEARCH(". ",C2)+2,1),"#"&UPPER(MID(C2,SEARCH(". ",C2)+2,1)))

    Then you iterate by copying the formula to the right (or downwards, as appropriate) until no more substitutions can be done.

    Then you replace all "#" in the final result by ". "

    =SUBSTITUTE(C5;"#";". ")

  6. Chandoo says:

    @Andy.. Brilliant stuff.. Took me some time to figure it out. (also, I didnt know PROPER("a1b2c3") will be A1B2C3. ) Thank you so much for sharing it here.

    @Gregor.. I would imagine pasting the whole thing in to MS Word, sentence casing it and then pasting back to Excel, If I ever need to do that. It is much faster and easier. Also, check Andy's formula above to understand a simpler (albeit geekier) version.

    @John, Andy: Technically, 999 should be as fast or even slightly faster than len() approach. Although it is slightly difficult to explain.

  7. Rick Rothstein (MVP - Excel) says:

    @Andy,

    Just to point out, your formula will only work for sentences that end with a period... it won't work correctly for sentences ending with a question mark or exclamation point, nor will it work correctly for titled names such as Dr. Who or Mrs. Jones.

  8. Bruce Spong says:

    May be dangerous to use because of other words that need to maintain their uppercasedness (is that a word?) But it's a good solution for small quantities of data that would be easy to proof. Cheers!

  9. Andy Wall says:

    @Rick Yes it would need a period and wouldn't work with other endings, nor would it work with names or possibly even product code id's or Klingon. As mentioned previously excel is probably not the best tool for the job. Just proves the point that a lot of things can be done in excel just maybe not optimally.

    @Chandoo thanks for the props. It's an interesting case of exploring native excel functionality to push the envelope.

  10. Rick Rothstein (MVP - Excel) says:

    @Andy - I was pretty sure you already knew the limitation of the formula; I posted my comments for completeness sake, that is, more for the reader's of the blog than for you. As for Excel (formulas) not being the best tool for the job... I'm not so sure VB is either. This is a very hard problem to code for because of all the exceptions that would have to be accounted for. Taking care of the punctuation at the end of sentences would not be too hard to code for, nor would name introducers (like Dr., Mr., etc.) as long as they are all identified beforehand so they could be coded for; but you raise an excellent point about product code IDs, and I would add company names to that as well (think IBM for example). As for Klingon, I don't speak it, so I don't know for sure if that could be coded for or not. By the way, I do agree with Chandoo... your substitution approach is clever, indeed; but, unfortunately, the underlying problems with the task are just too much for any formula approach I'm afraid.

  11. Andy Wall says:

    @ Rick - Just reread my reply and I didn't mean to sound facetious. My point was as you say, it'd be difficult to cope with all exceptions. Even wordprocessors fail at this at some point. I don't speak Klingon either, just a geek dialect of Excel! I find these type of problems, while not fully solvable, interesting for practice and discovery, and I love the fact that there is always more than one way to solve a problem in Excel. Maybe Chandoo could have a regular Excel mini challenge on the blog?

  12. Chandoo says:

    @Andy.. I like the idea of challenges. I have seen that community is vibrant on posts where I pose a challenge or leave some homework. I will try to a challenge once every 2-3 weeks.

  13. John says:

    Excellent. This will save me lots of time.

  14. Chandoo says:

    @JP.. very interesting link. Thank you for sharing it with us.

  15. [...] June 17, 2010 at 5:03 PM | Posted in General | Leave a Comment Tags: formulas, letter-case Chandoo brings up an interesting problem: How do you convert and fix the letter case in a sentence, using [...]

  16. BG2 says:

    Hello Chandoo, may I know if there is a formula to remove a comibination of number and text in one cell : MY-9876543. For example removing "MY-" in one cell.

  17. Hui... says:

    @BG2 Try =Right(YourCell,Len(YourCell)-Find("-",YourCell))

  18. BG2 says:

    whoa... thanks Hui. This is really helpful. 😀
    You make my day!!!

  19. [...] adding realtime scores updated from the web by visiting Realtime World Cup Scores.Sentence CaseIn Convert to Sentence Case, Chandoo provides a formula for converting to sentence case (that is, first word capitalizes, the [...]

  20. [...] adding realtime scores updated from the web by visiting Realtime World Cup Scores.Sentence CaseIn Convert to Sentence Case, Chandoo provides a formula for converting to sentence case (that is, first word capitalizes, the [...]

  21. Roz Lobo says:

    Thank you so much for the tip. It has saved me HOURS of work, and when you think about it, it is so logical!! thanks again.

  22. Nathalie says:

    This rocks!! HUGE time saver. thank you!

  23. Faurkh says:

    If i want to change whole column text in upper case at a time then how should i do this? e.g  In  Name column  farukh,samreen like this one by one many names then i want that name convert it into FARUKH,SAMREEN etc.

  24. faiz says:

    how can convert lower/uppercase to other sentence or number. example

    a = up
    A = down.

    so how can I convert lower case a to up & upper A to down

  25. nasreen says:

    Super... Thankyou for saving my time & lovely tip.. 🙂

  26. Vitor Canova says:

    It's almost 2018 and this is still the solution. No new formula in Excel to handle this.

Leave a Reply