Share via

Any Formulas that would recognize the difference between a persons name and a team names

William Auld 60 Reputation points
2026-02-07T18:08:22.52+00:00

As you can see there is no spaces between names and team names. I'm able to use

=REGEXEXTRACT, but this formula only divides when it see a uppercase letter.  Is there a formula that would convert the 1st letter to lowercase but not convert any other uppercase. Or is there a formula that would extract the team names only? There are only 20 teams.   Screenshot 2026-02-07 174147

Microsoft 365 and Office | Excel | For home | Windows
0 comments No comments
{count} votes

Answer accepted by question author
  1. IlirU 1,936 Reputation points Volunteer Moderator
    2026-02-08T14:04:55.53+00:00

    User's image

    Hi,

    I have placed a unique list of team names in column P and applied the following formula in cell S2 (see screenshot).

    =LET(pt, LOWER(N2:N21), tm, LOWER(P2:P19), lam, LAMBDA(a,b, SUBSTITUTE(a, b, "")), player, REDUCE(pt, tm, lam), PROPER(HSTACK(player, REDUCE(pt, player, lam))))

    Try this formula and let me know if it works for you or not. If it works, then please mark my answer as Valid Answer, as this way other users of this forum also benefit.

    IlirU

    1 person found this answer helpful.

3 additional answers

Sort by: Most helpful
  1. Dana D 0 Reputation points
    2026-02-08T01:56:51.18+00:00

    ..but this formula only divides when

    ..1st letter to lowercase but not convert any other uppercase

    You are using the correct formula. You should be able to use that 1 "simple" formula to apply your rule...

    User's image


  2. Ashish Mathur 101.7K Reputation points Volunteer Moderator
    2026-02-08T00:01:45.5733333+00:00

    Hi,

    This M code in Power Query works

    let
        Source = Excel.CurrentWorkbook(){[Name="Data"]}[Content],
        #"Added Custom" = Table.AddColumn(Source, "Position of first characters", each Text.PositionOfAny([Names],{" ","-","."})),
        #"Added Custom1" = Table.AddColumn(#"Added Custom", "Position of second capitalised letter", each Text.PositionOfAny([Names],{"A".."Z"},Occurrence.All){1}),
        #"Added Custom3" = Table.AddColumn(#"Added Custom1", "Revised names", each if [Position of second capitalised letter]>[Position of first characters] then Text.Middle([Names],[Position of first characters]+1,30) else [Names]),
        #"Added Custom2" = Table.AddColumn(#"Added Custom3", "Team", each Text.Middle([Revised names],Text.PositionOfAny([Revised names],{"A".."Z"},Occurrence.All){1},20))[[Names],[Team]]
    in
        #"Added Custom2"
    

    User's image

    0 comments No comments

  3. Marcin Policht 81,790 Reputation points MVP Volunteer Moderator
    2026-02-07T20:52:55.4466667+00:00

    Since it looks like your data has no spaces between the player names and team names, a reliable approach is to create a list of the 20 team names in a separate range (say X1:X20). Then you can use REGEXEXTRACT in combination with TEXTJOIN and ARRAYFORMULA to extract the team name. Essentially, the formula will look for any of the known team names in the string. For example, if your list of teams is in X1:X20 and your player+team string is in N2, you could use:

    =ARRAYFORMULA(TEXTJOIN("", TRUE, IF(REGEXMATCH(N2, X$1:X$20), X$1:X$20, "")))
    

    This will return the team name from the cell because it checks each possible team against the text and outputs the match.

    If you instead want to separate the player's name and convert the first letter of the player's name to lowercase while keeping the rest unchanged, you could use:

    =LOWER(LEFT(N2,1)) & MID(N2,2,LEN(N2)-LEN(ARRAYFORMULA(TEXTJOIN("", TRUE, IF(REGEXMATCH(N2, X$1:X$20), X$1:X$20, "")))))
    

    This works by taking the first letter, converting it to lowercase, and then appending the rest of the player's name (excluding the team name at the end).

    This approach avoids relying on uppercase letters to split the text, which fails in your dataset because both names and teams use uppercase letters internally.


    If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.

    hth

    Marcin


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.