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.
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.
SergeiBaklan Wow, this is great! Thanks very much. I took your instructions and updated the Excel file on my own (attached). While it did take a few minutes to complete on my desktop, it is a much preferred solution to anything I could do before.
- SergeiBaklanDec 05, 2019Diamond Contributor
If I don't answer in relatively short while many chance I will lose the conversation and never answer.
As for the file you changed the formula correctly.
- stevecccDec 05, 2019Brass ContributorHi Sergei, thanks. Just the fact you helped me one time is awesome. I don't expect people to respond to my questions quickly or even at all. When they do, it's just an amazing bonus.
- SergeiBaklanDec 04, 2019Diamond Contributor
Hi,
If that is IFERROR(...aggregate..., LEN($B2)+1) it shall be here. Sorry, I'm between meetings now, have no time to check the file. Most probably you are right, only here to change on LEN($B2)+2
- stevecccDec 04, 2019Brass Contributor
SergeiBaklan
I think I figured it out.
I changedLEN($B2)+1
To
LEN($B2)+2
And it works now. Do you think this is the best change that could be made? - stevecccDec 04, 2019Brass Contributor
Sergei, I took your latest player data extract example and tried to apply it to a third format.
In column I, the player's name that is extracted has the last letter cut off (see attached). I tried modifying the code but couldn't figure it out.
It seems like the issue is related to Cell S5, and the RIGHT function in the Column I formula, but I couldn't get it to work.
How do I modify this so the last letter of the player name in Column I is not cut off? Thanks!
- stevecccDec 04, 2019Brass ContributorThanks, this is great!
- SergeiBaklanDec 02, 2019Diamond Contributor
My previous file was more than 75MB which is limit for the this site.
I updated a bit with helper ranges
Performance is a bit better, but not significantly.
=IFERROR(MID($B2, SEARCH( N$4, SUBSTITUTE( " " & $B2,N$2,N$4,N$3) ) + N$5-2, IFERROR( AGGREGATE(15,6, 1/( SEARCH( $N$4:$V$4, SUBSTITUTE( " " & $B2,$N$2:$V$2,$N$4:$V$4,$N$3:$V$3 ) )-1 > SEARCH( N$4, SUBSTITUTE( " " & $B2,N$2,N$4,N$3) ) )* SEARCH( $N$4:$V$4, SUBSTITUTE( " " & $B2,$N$2:$V$2,$N$4:$V$4,$N$3:$V$3 ) ),1 ), LEN($B2)+1 ) - SEARCH( N$4, SUBSTITUTE( " " & $B2,N$2,N$4,N$3) ) - N$5+1 ),"")