View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max Max is offline
external usenet poster
 
Posts: 9,221
Default I am trying to abbreviate text in my description column.

"Antonio" wrote:
.. Is there a way to the take the first couple letters
in each work of the description?
Example: Description Holly-Blue Maid BB 5'
ID# holblmabb5


If you can live with just abbreviating the first letters, eg
in A1: Description Holly-Blue Maid BB 5', result in B1: DHMB5

then one way is to use this fine UDF (FrstLtrs) by Ron Rosenfeld

Here's the extract from Ron's posting to get you going ..

" .. Hi, I want to extract the 1st letter of each word in a string.
So for eg, in the string "my name is fred" I want to extract "mnif"

....

It's easy with a User Defined Function.
<alt<F11 opens the VB Editor.

Ensure your project is highlighted in the project explorer window, then
Insert/Module and paste the code below into the window.

To use this UDF, enter a formula of the type
=FrstLtrs(A1) where your string is in A1.

'===========
Function FrstLtrs(str As String) As String
Dim temp
Dim i As Long

temp = Split(Trim(str))

For i = 0 To UBound(temp)
FrstLtrs = FrstLtrs & Left(temp(i), 1)
Next i

End Function
'============
--ron ..."


With Ron's UDF implemented in your file,
Place in B1: =FrstLtrs(A1)
Copy down
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---