Forum Discussion
Extract different player names referring to an identical text string into separate columns.
- Dec 02, 2019
Let transform identifiers such way
i.e. <space><identifier><space><sequential number of identifier>
When formula in D2 could be
=IFERROR(MID($B2, SEARCH( REPT("@",LEN(LEFT(D$1,LEN(D$1)-1))), SUBSTITUTE( " " & $B2, LEFT(D$1,LEN(D$1)-1), REPT("@",LEN(LEFT(D$1,LEN(D$1)-1))), RIGHT(D$1)) ) + LEN(D$1)-2, IFERROR( AGGREGATE(15,6, 1/( SEARCH( REPT("@",LEN(LEFT($D$1:$L$1,LEN($D$1:$L$1)-1))), SUBSTITUTE( " " & $B2, LEFT($D$1:$L$1,LEN($D$1:$L$1)-1), REPT("@",LEN(LEFT($D$1:$L$1,LEN($D$1:$L$1)-1))), RIGHT($D$1:$L$1) ) )-1 > SEARCH( REPT("@",LEN(LEFT(D$1,LEN(D$1)-1))), SUBSTITUTE( " " & $B2, LEFT(D$1,LEN(D$1)-1), REPT("@",LEN(LEFT(D$1,LEN(D$1)-1))), RIGHT(D$1) ) ) )* SEARCH( REPT("@",LEN(LEFT($D$1:$L$1,LEN($D$1:$L$1)-1))), SUBSTITUTE( " " & $B2, LEFT($D$1:$L$1,LEN($D$1:$L$1)-1), REPT("@",LEN(LEFT($D$1:$L$1,LEN($D$1:$L$1)-1))), RIGHT($D$1:$L$1) ) ),1 ), LEN($B2)+1 ) - SEARCH( REPT("@",LEN(LEFT(D$1,LEN(D$1)-1))), SUBSTITUTE( " " & $B2, LEFT(D$1,LEN(D$1)-1), REPT("@",LEN(LEFT(D$1,LEN(D$1)-1))), RIGHT(D$1) ) ) - LEN(D$1)+1 ),"")
when drag to the right and down (or better use Ctrl+D).
Perhaps formula could be optimized, but it will take time to play with it and find another way if any. Right now it takes few minutes to fill couple hundred thousand rows. Thus better to test on few ones.
That is in second sheet of the attached file.
UPDATE: I failed to upload the file, will try once more tomorrow.
- SergeiBaklanDec 01, 2019Diamond Contributor
The easiest and simplest way is to do that with Power Query, I updated it with duplication remove in old file (second sheet).
Since you consider only formulas - don't know right now what and how to do.
- stevecccDec 02, 2019Brass Contributor
Sergei, is there an way to search and replace the separators with different names? I couldn't figure it out, but if so that would make your formula solution work. For example,
Original data:
QB Drew Brees RB Alvin Kamara FLEX Leonard Fournette RB Brian Hill WR DJ Moore WR Jarvis Landry WR Allen Hurns TE Jared Cook DST Broncos
Data with new separators:
QB Drew Brees RB1 Alvin Kamara FLEX Leonard Fournette RB2 Brian Hill WR1 DJ Moore WR2 Jarvis Landry WR3 Allen Hurns TE Jared Cook DST Broncos
How to quickly change the name of the separators? Find/Replace does not work. I imagine it requires some combination of COUNT, AND, OR.- SergeiBaklanDec 02, 2019Diamond Contributor
And which exactly formula do you mean? If as in Sheet1 (5) in attached file you only need to change headers of resulting columns on new separators
The only don't forget to wrap each separator by spaces. The could be automated a bit, but let define first what is required.
- stevecccDec 02, 2019Brass Contributor
SergeiBaklan Thanks very much Sergei. I very much appreciate it. I will look into using Power Query.