A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Acronym Function?



 
 
Thread Tools Display Modes
  #1  
Old March 11th, 2010, 08:42 PM posted to microsoft.public.excel.worksheet.functions
msnyc07
external usenet poster
 
Posts: 97
Default Acronym Function?

Is there anyway to generate an acronym on cell contents with a function?

Ideally I could ignore certain words e.g. of, the, and, etc. and then for
the first letter of each word generate an acronym e.g.

United States of America = USA
  #2  
Old March 11th, 2010, 09:08 PM posted to microsoft.public.excel.worksheet.functions
Mike H
external usenet poster
 
Posts: 8,419
Default Acronym Function?

Hi,

Try this UDF which extracts the first capital of each word

Function FrstLtrs(MyStr As String) As String
Dim temp
Dim i As Long
TmpStr = Split(Trim(MyStr))
For i = 0 To UBound(TmpStr)
If Asc(Left(TmpStr(i), 1)) = 65 And _
Asc(Left(TmpStr(i), 1)) = 90 Then
FrstLtrs = FrstLtrs & Left(TmpStr(i), 1)
End If
Next
End Function

--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"msnyc07" wrote:

Is there anyway to generate an acronym on cell contents with a function?

Ideally I could ignore certain words e.g. of, the, and, etc. and then for
the first letter of each word generate an acronym e.g.

United States of America = USA

  #3  
Old March 11th, 2010, 09:15 PM posted to microsoft.public.excel.worksheet.functions
msnyc07
external usenet poster
 
Posts: 97
Default Acronym Function?

Awesome, thanks so much!

"Mike H" wrote:

Hi,

Try this UDF which extracts the first capital of each word

Function FrstLtrs(MyStr As String) As String
Dim temp
Dim i As Long
TmpStr = Split(Trim(MyStr))
For i = 0 To UBound(TmpStr)
If Asc(Left(TmpStr(i), 1)) = 65 And _
Asc(Left(TmpStr(i), 1)) = 90 Then
FrstLtrs = FrstLtrs & Left(TmpStr(i), 1)
End If
Next
End Function

--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"msnyc07" wrote:

Is there anyway to generate an acronym on cell contents with a function?

Ideally I could ignore certain words e.g. of, the, and, etc. and then for
the first letter of each word generate an acronym e.g.

United States of America = USA

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:57 AM.


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