Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Capitalize only first letter in sentence

In Excel 2003, I am referencing a text string and would like to return the
text string with only the first letter capitalized. The PROPER function does
not do this, as it capitalizes the first letter of every word. The formula
below does however perform this, but I would like to write it as a
User-Defined Function, similar to the Proper function, so it can be applied
to multiple different workbooks:

=UPPER(LEFT(A1,1))&LOWER(RIGHT(A1,LEN(A1)-1))

Is it even possible to write a User-Defined Function to complete this
seemingly simple task and, if so, how do I do it?

Thanks,
Chris
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 7,247
Default Capitalize only first letter in sentence

Try code like

Function ChangeCase(S As String) As String
ChangeCase = UCase(Left(S, 1)) & LCase(Mid(S, 2))
End Function

Then, call it from a cell with

=ChangeCase(A1)


Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



On Tue, 2 Dec 2008 13:18:01 -0800, ChrisHT
wrote:

In Excel 2003, I am referencing a text string and would like to return the
text string with only the first letter capitalized. The PROPER function does
not do this, as it capitalizes the first letter of every word. The formula
below does however perform this, but I would like to write it as a
User-Defined Function, similar to the Proper function, so it can be applied
to multiple different workbooks:

=UPPER(LEFT(A1,1))&LOWER(RIGHT(A1,LEN(A1)-1))

Is it even possible to write a User-Defined Function to complete this
seemingly simple task and, if so, how do I do it?

Thanks,
Chris

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
capitalize first letter rodchar Excel Discussion (Misc queries) 14 December 19th 08 01:47 PM
How do I capitalize the first letter of multiple cells? dominic_howden Excel Discussion (Misc queries) 5 December 11th 08 08:45 PM
capitalize first letter automatically raft Excel Discussion (Misc queries) 5 May 1st 08 01:10 PM
Capitalize first letter in sentence Lightjag Excel Worksheet Functions 13 January 15th 08 02:25 PM
Capitalize first letter when type a name in each cell. Craig Brody Excel Worksheet Functions 6 December 20th 04 03:21 PM


All times are GMT +1. The time now is 12:03 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"