Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, and 2016. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Capitalizing Just a Surname.
by Allen Wyatt
(last updated June 30, 2018)
Cheryl is using a worksheet that has, in column A, client names in the format "Smith, Jane." She would like to capitalize only the surname, as in "SMITH, Jane", leaving the rest of the name unchanged.
If there is one and only one comma that separates the surname from the first name, you can create a formula to do the conversion. Assuming the name is in A1, the formula would be:
If you prefer to not use a formula (which may mess up the look of your worksheet), you could also use a macro to convert the names, in place. Consider the following:
Sub CapitalizeSurnames() Dim rCell As Range Dim iComma As Integer For Each rCell In Selection iComma = InStr(rCell, ",") If iComma > 0 Then rCell = UCase(Left(rCell, iComma - 1)) & _ Mid(rCell, iComma) End If Next Set rCell = Nothing End Sub
Simply select the cells that you want to convert (such as those in column A) and then run the macro. It makes the conversion to the names in the cells.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (12639) applies to Microsoft Excel 2007, 2010, 2013, and 2016. You can find a version of this tip for the older menu interface of Excel here: Capitalizing Just a Surname.
Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!
When you work with imported or pasted data in an Excel worksheet, you may see some strange looking characters at times. ...Discover More
Need to edit the data within a cell? There are any number of ways you can perform the edit; this tip documents them all.Discover More
Do you need to paste formulas without updating the references in whatever you are pasting? You can accomplish this, ...Discover More
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.