Text.Proper Function (Power Query M)

Text.Proper capitalizes the first letter of each word and lowercases the rest. Available in Excel (Power Query), Power BI Desktop, and Power BI Service.

If you want to clean up name or text columns so each word starts with a capital, this is the function you reach for. It takes a text value and hands back a tidy, proper-cased version.

Syntax of Text.Proper Function

Text.Proper(text as nullable text, optional culture as nullable text) as nullable text

where

  • text (required, nullable text). The text value you want to proper-case.
  • culture (optional, nullable text). A culture code such as "en-US" that controls casing rules. Omit it for the default behavior.

Returns: the text with the first letter of each word capitalized and every other letter in lowercase. If text is null, it returns null.

In plain terms, you give it a string and it gives you back the same string with proper casing applied.

Example 1: Proper-case a simple name

Capitalize each word in a lowercase name.

Text.Proper("john smith")

Result: John Smith

Both words get their first letter capitalized.

Example 2: It lowercases existing caps, then rebuilds the case

Text.Proper("the QUICK bROWN fox")

Result: The Quick Brown Fox

It does not just touch the first letter. It lowercases every interior capital first, then capitalizes the first letter of each word. So QUICK becomes Quick and bROWN becomes Brown.

Example 3: It capitalizes after every apostrophe and hyphen

This is the gotcha to watch for.

Text.Proper("o'brien from new-york met mcdonald")

Result: O'Brien From New-York Met Mcdonald

The function treats any non-letter as a word boundary, so it capitalizes the letter right after each apostrophe and hyphen. That gives you O'Brien and New-York. And because the only break in mcdonald is at the start, you get Mcdonald, with a lowercase donald.

Example 4: Proper-case a Name column in a table

Proper-casing a whole column is the most common use of this function.

Say you have a Staff query with a FullName and a Dept column.

Here is the starting data:

FullNameDept
amir KHANfinance
mary-jane WATSONdesign
o’connor liamsupport

Now apply Text.Proper to the FullName column with Table.TransformColumns:

let
Source = Excel.CurrentWorkbook(){[Name="Staff"]}[Content],
Result = Table.TransformColumns(Source,{{"FullName",Text.Proper}})
in
Result

The result proper-cases every name and leaves Dept untouched:

FullNameDept
Amir Khanfinance
Mary-Jane Watsondesign
O’Connor Liamsupport

The hyphen in Mary-Jane and the apostrophe in O'Connor both trigger a capital, same as Example 3.

Example 5: Null input returns null

Text.Proper(null)

Result: null

A null passes straight through, so you do not get an error on blank cells.

Things to keep in mind with Text.Proper

  • It capitalizes after any non-letter, not just spaces. Apostrophes, hyphens, and digits all trigger a capital, which mangles names like O'Brien and McDonald (Example 3). To fix specific names, clean them up afterward with Text.Replace or a small custom function.
  • It flattens ALL-CAPS acronyms. Because it lowercases every letter it does not capitalize, "USA" becomes Usa and "NASA report" becomes Nasa Report. Protect acronyms with a separate replace step.
  • A number throws an error. Passing a non-text value like 42 raises Expression.Error: We cannot convert the value 42 to type Text. Convert it first with Text.From.
  • culture is rarely needed. The default casing handles standard English text. Reach for it only when a locale capitalizes differently.

Performance and query folding

Against a foldable source such as SQL Server, a Text.Proper step usually does not fold, since most databases have no single equivalent. It runs locally instead. On Excel, CSV, or folder sources it always runs locally, which is fast for thousands of rows.

Common questions about Text.Proper

How do I keep names like McDonald and O’Brien correct?

Run Text.Proper first for the bulk of the work, then patch the exceptions with a replace step. A column-wide swap with Table.ReplaceValue, for example replacing Mcdonald with McDonald, fixes the known offenders. For many such names, a lookup table of corrections applied after the proper-case step is cleaner than one giant chain of replacements.

What is the difference between Text.Proper, Text.Upper, and Text.Lower?

Text.Proper capitalizes the first letter of each word and lowercases the rest. Text.Upper makes everything uppercase, and Text.Lower makes everything lowercase. To apply any of these across a plain list of values rather than a table column, wrap them in List.Transform.

List of All Power Query Functions

Related Power Query Functions / Articles:

I am a huge fan of Microsoft Excel and love sharing my knowledge through articles and tutorials. I work as a business analyst and use Microsoft Excel extensively in my daily tasks. My aim is to help you unleash the full potential of Excel and become a data-slaying wizard yourself.