Extract first 3 Characters from each word

jarett

Board Regular
Joined
Apr 12, 2021
Messages
105
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Trying to extract the first three characters from each word in a cell, I was reading this article to extract the first character. Not sure if I could use this with some revision to get what I need. This is what I am trying to do
Cell A1 = Electric Blue/ Electric Blue Tonal Blend
Desired output = Ele Blu Ele Blu Ton Ble
I am indifferent on the "/" being left in and I would rather do away with the spaces in the output.
How to extract first letter of each word from cell?
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

lrobbo314

Well-known Member
Joined
Jul 14, 2008
Messages
3,557
Office Version
  1. 365
Platform
  1. Windows
How about this?

Book3 (version 2).xlsb
AB
1Electric Blue/ Electric Blue Tonal BlendEle Blu Ele Blu Ton Ble
Sheet6
Cell Formulas
RangeFormula
B1B1=TEXTJOIN(" ",1,LEFT(FILTERXML("<a><b>" & SUBSTITUTE(A1," ","</b><b>") & "</b></a>","//b"),3))
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
77,891
Office Version
  1. 365
Platform
  1. Windows
How about
Fluff.xlsm
AB
1
2Electric Blue/Electric Blue Tonal BlendEle Blu Ele Blu Ton Ble
Test
Cell Formulas
RangeFormula
B2B2=TEXTJOIN(" ",,LEFT(FILTERXML("<k><m>"&SUBSTITUTE(SUBSTITUTE(A2,"/"," ")," ","</m><m>")&"</m></k>","//m"),3))
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
65,566
Office Version
  1. 365
Platform
  1. Windows
If you like using the UDF, try this modification:
VBA Code:
Function GetFirstLetters(rng As Range) As String
'Update 20140325
    Dim arr
    Dim I As Long
    arr = VBA.Split(rng, " ")
    If IsArray(arr) Then
        For I = LBound(arr) To UBound(arr)
            GetFirstLetters = GetFirstLetters & Left(arr(I), 3) & " "
        Next I
    Else
        GetFirstLetters = Left(arr, 3) & " "
    End If
    
    GetFirstLetters = Trim(GetFirstLetters)
    
End Function
 
Solution

jarett

Board Regular
Joined
Apr 12, 2021
Messages
105
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
If you like using the UDF, try this modification:
VBA Code:
Function GetFirstLetters(rng As Range) As String
'Update 20140325
    Dim arr
    Dim I As Long
    arr = VBA.Split(rng, " ")
    If IsArray(arr) Then
        For I = LBound(arr) To UBound(arr)
            GetFirstLetters = GetFirstLetters & Left(arr(I), 3) & " "
        Next I
    Else
        GetFirstLetters = Left(arr, 3) & " "
    End If
   
    GetFirstLetters = Trim(GetFirstLetters)
   
End Function
This one worked great, thanks.
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
65,566
Office Version
  1. 365
Platform
  1. Windows
You are welcome.
Glad we were able to help!
 

Forum statistics

Threads
1,176,634
Messages
5,904,156
Members
435,074
Latest member
McKay_S

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top