Members-only tutorial

Watch the video and get the practice sheet with membership.

See membership options

Build Your Own PROPER() Custom Apps Script Function to Capitalize Each Word

About this Tutorial

There's something wrong with PROPER() the google sheets function. Let's fix it by customizing our own TitleCase() function inside of Apps Script.

Featured Formulas

Video Transcript

<div>0:00 Alright, so you have a text and you want to capitalize it, each and every, uh, word in that text. And do you see sort Learn how to sort your data effectively in Google Sheets. Opens in new tab of a problem with this?<br>0:08 Uh, do you see on the left is the original and on the right is what's called title case or in Google Sheets term proper?<br>0:16 You'll see there's a difference between these two things. Uh, one of them is that there's an apostrophe S and then the S is capitalized.<br>0:25 But we're using proper which is the actual built-in function Understand the basics of functions in Google Sheets. Opens in new tab inside of abscr- uh not in abscr- in Google Sheets.

It's uh one of the most used ones and it's capitalizing.<br>0:38 It's doing this wrong. It's not capitalizing the first character of every word. It's capitalizing after this apostrophe as well. But I created this.<br>0:48 Created my own where Discover how to use the WHERE clause in queries. Opens in new tab the only the first letter is capitalized, not after the apostrophes. And I'm going to show you how to do this and how to add a little bit extra stuff.<br>0:57 So go up to extensions, Apps Script Explore Google Apps Script for custom functions. Opens in new tab . If you want to type this out yourself, go ahead. We're going to take, we're going to call it.<br>1:04 Function Understand the basics of functions in Google Sheets. Opens in new tab title. We're going to take some input text.

That is the name of it. We can rename this any text if we want.<br>1:12 And not that it is literally text, but it is like any text. Uh, we're going to save that. We're going to take the words.<br>1:20 Which will split Find out how to split text into separate parts in Sheets. Opens in new tab with just this little split Find out how to split text into separate parts in Sheets. Opens in new tab with a space. So every space will be split Find out how to split text into separate parts in Sheets. Opens in new tab . And then we're going to map a function Understand the basics of functions in Google Sheets. Opens in new tab where Discover how to use the WHERE clause in queries. Opens in new tab each and every word, we're going to get the character that's at zero, which is the very first character.<br>1:34 We're going to upcase it.

And then we're going to, We're going to slice it and everything to lowercase and put them all together, put everything together in this join.<br>1:44 So that means if we have some improper capitalization, we don't have it here. It can be done here, right? This proper is doing that correctly, but we're also doing that, we're making sure that only the first character is capitalized, but we're also making sure that not after the apostrophe.<br>2:03 So this is what the title, this function Understand the basics of functions in Google Sheets. Opens in new tab title is doing.

I'm to make it run like a custom function Understand the basics of functions in Google Sheets. Opens in new tab inside of Google Sheets, and all I have to do is add this little text at the beginning, which is at custom function Understand the basics of functions in Google Sheets. Opens in new tab .<br>2:22 I'm going to hit save, and now I'm going to copy and paste this. And if I hit equals T**** equal title, there it is, it's now showing up.<br>2:34 And now it shows me this uh input, any text, it has some other uh information if I want I can that there, but I just want to make it run like a native function Understand the basics of functions in Google Sheets. Opens in new tab , and it's doing that now.<br>2:45 And we can name this anything we want.

Title, we can say title, each letter, each word, sorry, each word, not title.<br>2:56 we want. Capitalize each word. So hit save, make sure it's saved, and now instead of title, equals capitalize each word.<br>3:08 So we can name this anything we want. We can even create multiple of these. Then if we don't remember the name, title case maybe, or title case each word.<br>3:22 All of these are doing exactly the same. They all have at custom function Understand the basics of functions in Google Sheets. Opens in new tab , and now they'll all show up. So we can also rename title case.<br>3:31 We can also add title if we want.

If we don't remember that it's fully title case, so we start typing equals title.<br>3:40 We have title, title case, title case each word. We have equals, capital, capital, capitalized each word there and they all work the same way because they're each the same app script Explore Google Apps Script for custom functions. Opens in new tab .<br>3:50 And so we can create basically a better proper or a better function Understand the basics of functions in Google Sheets. Opens in new tab that already exists inside of Google Sheets and also I wanted to make sure you remember this.<br>4:00 You can create multiple app scripts and multiple functions Get to know different functions available in Google Sheets. Opens in new tab with different names that do the exact same thing.

If for some reason you may create an app script Explore Google Apps Script for custom functions. Opens in new tab for a function Understand the basics of functions in Google Sheets. Opens in new tab that you have multiple names for and I think that's really awesome too.<br>4:13 Because this proper is not really, I've never heard. I've heard of this nomenclature proper. I always hear title case or headline case.<br>4:20 Headline this, right? If you want to create this function Understand the basics of functions in Google Sheets. Opens in new tab for creating headlines or capitalizing correctly headlines, maybe you want to call it headline case.<br>4:29 Whatever you want to do, you can now do that here. app script Explore Google Apps Script for custom functions. Opens in new tab with this at custom function Understand the basics of functions in Google Sheets. Opens in new tab . I think really really cool.</div>