Initials in a multiple-word cell

Andresleo47

Board Regular
Joined
Oct 29, 2008
Messages
132
Hi Mr. Excel fellas! Hoping you're doing well.

The following are some of the values that I have in a single column:

332241
4321 - P1 W2 John Smith
Balance for Alvin James Fox
12345 - P10 W4 Carl Sagan
12345

Now, I need to put the initials of the names in the next column, so, the output would be

-
JS
AJF
CS
-

Any thoughts?

This is something I would truly appreciate!

Thanks so much,

AV
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
This seems like it's working pretty well.

Book2
ABCDEFGHIJK
1Column1Column2Column3Column4Column5Column6Column7Column8Column9Column10Initials
2480393518604590990Z543642251.33310672 - P7 W2 Jean Sebestien Pelletier43642N43 381 172Canadian Forces CF H SVCSJ.S.P.
3480393518604590991Z543642174.33310674 - P7 W2 Jean Sebestien Pelletier43642N43 381 172Canadian Forces CF H SVCSJ.S.P.
4480393518604590992Z5436422523310678 - P7 W2 Natasha Trzebinski43642T31741714Canadian Forces CF H SVCSN.T.
5480393188604608537Z5434822753227881 - P1 W3 Jordan Houghton43482MILITARYCanadian Forces CF H SVCSJ.H.
64803928318604611548Z543678120.73326480 - P8 W3 Evaughn Heath436780Canadian Forces CF H SVCSE.H.
7480393188604640036Z5437122753344673 - P9 W4 Katelyn Young43712MILITARYCanadian Forces CF H SVCSK.Y.
8480393188604661530Z543556335.43264657 - P4W2 Josee Robitaille43556MILITARYCanadian Forces CF H SVCSJ.R.
9480393188604686410Z5434832243228771 - P1 W3 Jean-Sebastien Giroux43483MILITARYCanadian Forces CF H SVCSJ.G.
104803915258604781354Z5436862753331046 - P9 W2 Eric Diffey43686M62329083Canadian Forces CF H SVCSE.D.
114803915258604826841Z5436862753331047 - P8 W4 Eric Diffey43686M62329083Canadian Forces CF H SVCSE.D.
1248938AA31812271402157260ZZ43461-155AA318122743461AA3181227First Nations & Inuit Health NHIB
134893815411402748094ZZ43551-239.85458484355145848First Nations & Inuit Health NHIB
144893815241403038618ZZ43790-27512937943790129379First Nations & Inuit Health NHIB
15489384129781403077175ZZ43615-228.2941297843615412978First Nations & Inuit Health NHIB
16489381177941403228075ZZ43759-209.311779443759117794First Nations & Inuit Health NHIB
174893815021403312853ZZ44082-230587029324408258702932First Nations & Inuit Health NHIB
18489385761601397002DA43327-13516921743327530161501First Nations & Inuit Health NHIB
194893815021601571163DA43573-3.3767065435738380045801First Nations & Inuit Health NHIB
204893815021601943361DA4338421.84412445433844580358302First Nations & Inuit Health NHIB
214893815021602069334DA43886264833438864500112901First Nations & Inuit Health NHIB
224893815261602205860DA43755-119.7117794437556220030903First Nations & Inuit Health NHIB
234893815788601210817Z543085182.42862117 - P13 W2 Matthew Saddleback430854440670701First Nations & Inuit Health NHIBM.S.
244893815028601243790Z5431301192961899 - P02 W1 Hayden Matchee431304580824701First Nations & Inuit Health NHIBH.M.
254893815418601390598Z543090182.42878264 - P13 W3 Tyler Jacques43090510363301First Nations & Inuit Health NHIBT.J.
264893815028601392256Z543108240.312941274 - P01 W2 Reginald Siddall431083450069601First Nations & Inuit Health NHIBR.S.
274893815508601688307Z5431481492911422 - P02 W3 Logan Gavey431484620832601First Nations & Inuit Health NHIBL.G.
284893815028601908668Z543069184.592914556 - P12 W4 Kaydence Wahsatnow430694620837101First Nations & Inuit Health NHIBK.W.
294893815028601915165Z543068184.592914549 - P12 W4 Ferleen Kakeesim430684620169605First Nations & Inuit Health NHIBF.K.
304893815798601919253Z5431261422886711 - P01 W4 Cynthia Sagstven431264430132101First Nations & Inuit Health NHIBC.S.
314893815028601986103Z543104228.292912954 - P01 W1 Doris Laboucan431044590028501First Nations & Inuit Health NHIBD.L.
324893815028602069201Z543099228.292935906 - P13 W4 Jolene gray4309945901144-01First Nations & Inuit Health NHIBJ.G.
334893815028602082218Z543215184.592975056 - P05 W1 Liza Jerome4321576200285-01First Nations & Inuit Health NHIBL.J.
344893815028602241215Z543209190.143012404 - P04 W4 joan McKinley43209110051101First Nations & Inuit Health NHIBJ.M.
354893815028602332261Z543214131.43030481 - P05 W1 Valencia Del-hierro432143760250701First Nations & Inuit Health NHIBV.D.
364893815028602351369Z543120180.982954286 - Samantha Veltkamp431203710110202First Nations & Inuit Health NHIBS.V.
374893815438602379944Z543151228.292980489 - P02 W4 Mary Thomas431516830019401First Nations & Inuit Health NHIBM.T.
384893815028602383392Z543126228.292958912 - P01 W4 Barbara Shindeka431266840047401First Nations & Inuit Health NHIBB.S.
Sheet3


Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    DoubleSpace = Table.TransformColumns(Source,{{"Column7", each try Text.Trim(Text.Replace(Text.Replace(Text.Replace(Text.Replace(_,"  "," "),"(",""),")",""),".","")) otherwise _}}),
    Hyphens = Table.AddColumn(DoubleSpace, "Custom", each if Text.Contains(Text.From([Column7]),"-") then [Column7] else null),
    Split = Table.SplitColumn(Hyphens, "Custom", Splitter.SplitTextByDelimiter(" - ", QuoteStyle.Csv), {"Custom.1", "Custom.2"}),
    toList = Table.AddColumn(Split, "Custom", each try Text.Split([Custom.2]," ") otherwise null),
    tList = Table.AddColumn(toList, "Custom.3", each try List.Transform([Custom], each if Text.Length(Text.Select(_,{"0".."9"})) = 0 then Text.Start(_,1) & "." else null) otherwise null),
    Initials = Table.AddColumn(tList, "Initials", each try Text.Trim(Text.Combine([Custom.3],"")) otherwise null),
    RC = Table.RemoveColumns(Initials,{"Custom.1", "Custom.2", "Custom", "Custom.3"}),
    toUpper = Table.TransformColumns(RC,{{"Initials", Text.Upper, type text}})
in
    toUpper
 
Upvote 0
Oh nice, thanks...Can I add it to a Macro? Or should it be added with a Power Query?
Add it via Power Query.

You select your data in your worksheet. Then, on the 'Data' tab, under 'Get & Transform' click 'From Table'. This will load your data into Power Query. Then, in Power Query, click on 'Advanced Editor' and paste the code from my post. Then, click 'Close and Load'.
 
Upvote 0
Ok, nice...I tried it, and the following error pops up: "
Expression.Error: We couldn't find an Excel table named 'Table1'.
Details:
Table1"

Is it normal? Thanks so much!
 
Upvote 0
Ok, nice...I tried it, and the following error pops up: "
Expression.Error: We couldn't find an Excel table named 'Table1'.
Details:
Table1"

Is it normal? Thanks so much!
It sounds like you might have already added a table before. Look at the 'Name Manager' under the 'Formula' tab to find out what your table is named, then change this line...

Power Query:
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content]

and replace "Table1" with the name of your table.
 
Upvote 0
  • select your source whole data
  • use Ctrl+T
  • as I see there is no headers so choose the same : My table has headers - unchecked
  • check in Name Manager the name of the table
  • refresh query in Power Query Editor (if the code still exist in Advanced Editor)
 
Upvote 0
Great, it worked very well taking the headers off... Now the headers look like Column 1, Column 2, etc... How can I copy the resulting Column to the original Excel file? Thanks guys for your help
 
Upvote 0

Forum statistics

Threads
1,216,028
Messages
6,128,392
Members
449,445
Latest member
JJFabEngineering

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
Back
Top