Splitting first and last names without spaces

MSP

New Member
Joined
Mar 8, 2013
Messages
3
Good morning,

I recently pulled a list of golfer names from a folder and I need to add a space between the first and last names. The first names are all in lowercase and the last names are all in uppercase:

tigerWOODS
philMICKELSON
jordanSPIETH
maxHOMA

I found a formula in this thread and it's very close to what I'm looking for. But I want to put the space between the last lowercase and first uppercase letters and it has to work for a list of 200 people. How would I do that?

Thanks,

MSP
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
How about

VBA Code:
Function jec(xStr As String) As String
 With CreateObject("vbscript.regexp")
   .Pattern = "([a-z])([A-Z])"
   jec = .Replace(xStr, "$1 $2")
 End With
End Function


Book1
AB
1tigerWOODStiger WOODS
2philMICKELSONphil MICKELSON
3jordanSPIETHjordan SPIETH
4maxHOMAmax HOMA
Sheet1
Cell Formulas
RangeFormula
B1:B4B1=jec(A1)
 
Upvote 0
Or if you use Office 365

Excel Formula:
=LET(x,SEQUENCE(LEN(A1),,2),REPLACE(A1,MIN(IFERROR(1/(1/((CODE(MID(A1,x,1))<97)*x)),EXP(99))),0," "))

Or for older versions you can use this as array formula ( close with CTRL + SHIFT + RETURN)

Excel Formula:
=REPLACE(A1,MIN(IFERROR(1/(1/((CODE(MID(A1,ROW($2:$99),1))<97)*(ROW($2:$99)))),EXP(99))),0," ")
 
Upvote 0
Solution
And a Power Query solution.

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    sp = Table.SplitColumn(Source, "Name", Splitter.SplitTextByCharacterTransition({"a".."z"}, {"A".."Z"}), {"Name", "Name2"}),
    comb = Table.CombineColumns(sp,{"Name", "Name2"},Combiner.CombineTextByDelimiter(" ", QuoteStyle.None),"Name")
in
    comb

Book1
ABC
1NameName
2tigerWOODStiger WOODS
3philMICKELSONphil MICKELSON
4jordanSPIETHjordan SPIETH
5maxHOMAmax HOMA
Sheet1
 
Upvote 0
Or if you use Office 365

Excel Formula:
=LET(x,SEQUENCE(LEN(A1),,2),REPLACE(A1,MIN(IFERROR(1/(1/((CODE(MID(A1,x,1))<97)*x)),EXP(99))),0," "))

Or for older versions you can use this as array formula ( close with CTRL + SHIFT + RETURN)

Excel Formula:
=REPLACE(A1,MIN(IFERROR(1/(1/((CODE(MID(A1,ROW($2:$99),1))<97)*(ROW($2:$99)))),EXP(99))),0," ")
Thanks @JEC this did the trick. I am on Office 365.

I'm trying to understand this formula: The Name_value1 part of the formula is SEQUENCE(LEN(A2),,2), which seems to start the formula at the 2nd character instead of the 1st. Is that the case? If so, why is that? Also, are 97 and 99 lower/upper ASCII values?
 
Upvote 0
They are lowercase. I started at 2 in case of names starting with capital
 
Upvote 0
Another option:

Excel Formula:
=LET(a,CHAR(SEQUENCE(26,,65)),REPLACE(A1,MIN(FIND(a,A1&CONCAT(a))),0," "))
 
Upvote 0
I am on Office 365.

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,206
Members
453,022
Latest member
RobertV1609

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