Forum Discussion

Pedro_Duarte's avatar
Pedro_Duarte
Copper Contributor
Nov 15, 2022
Solved

Text join + filter data

i'm trying to join text that are equal in coloumn A but values start in some text cell and end on other text cell but it has to be in the line taht is equal in coloumn A


=UNIRTEXTO(", ";VERDADEIRO;SE((D2)=(Folha2!A:A);SE(Folha2!B:AJ<>"";Folha2!B:AJ;"");""))

 

number 15406 (to be equal in sheet2 A:A)
Start Paredes (to be the start of the join text that is located in sheet2 B:AJ)
Finish Rio tinto (to be the end of the join text that is located in sheet2 B:AJ)

 

being that number is 1 parameter to be equal and the start is the begining of the filter and the Finish is the last value to be joined but start and finish are changeable.

 

it's showing every result and it should be showing only from "paredes" to "rio Tinto"

 

number15406
StartParedes
FinishRio tinto
ResultPenafiel, Paredes, Oleiros, Irivo, Cête, Parada, Recarei-Sobreira, Trancoso, Terronhas, São Martinho do Campo, Valongo, Suzão, Cabeda, Ermesinde, Águas Santas/ Palmilheira, Rio Tinto, Contumil, Porto - Campanhã, Porto - São Bento

 

 

numberresults to be filtered                          
15506Marco de CanavesesLivraçãoRecesinhosVila MeãOliveiraCaídeMeinedoBusteloPenafielParedes  Cête Recarei-Sobreira   ValongoSuzão ErmesindeÁguas Santas/ PalmilheiraRio TintoContumilPorto - CampanhãPorto - São Bento
15402        PenafielParedesOleirosIrivoCêteParadaRecarei-SobreiraTrancosoTerronhasSão Martinho do CampoValongoSuzãoCabedaErmesindeÁguas Santas/ PalmilheiraRio TintoContumilPorto - CampanhãPorto - São Bento
15508Marco de CanavesesLivração Vila Meã CaídeMeinedo PenafielParedes  Cête Recarei-Sobreira   ValongoSuzão ErmesindeÁguas Santas/ PalmilheiraRio TintoContumilPorto - CampanhãPorto - São Bento
15404        PenafielParedesOleirosIrivoCêteParadaRecarei-SobreiraTrancosoTerronhasSão Martinho do CampoValongoSuzãoCabedaErmesindeÁguas Santas/ PalmilheiraRio TintoContumilPorto - CampanhãPorto - São Bento
  • Pedro_Duarte 

    =LET(filter,TEXTJOIN(",",,FILTER(Folha2!B2:AB5,Folha2!A2:A5=Folha1!B1)),after,LEFT(filter,FIND(B2,filter)-1),textafter,TEXTAFTER(filter,after),before,FIND(B3,filter),textbefore,RIGHT(filter,LEN(filter)-before-LEN(B3)+1),TEXTBEFORE(textafter,textbefore))

    You can try this formula.

     

    Folha1:

     

    Folha2:

     

    =TEXTVOR(TEXTNACH(TEXTVERKETTEN(",";;FILTER(Folha2!B2:AB5;Folha2!A2:A5=Folha1!B1));LINKS(TEXTVERKETTEN(",";;FILTER(Folha2!B2:AB5;Folha2!A2:A5=Folha1!B1));FINDEN(B2;TEXTVERKETTEN(",";;FILTER(Folha2!B2:AB5;Folha2!A2:A5=Folha1!B1)))-1));RECHTS(TEXTNACH(TEXTVERKETTEN(",";;FILTER(Folha2!B2:AB5;Folha2!A2:A5=Folha1!B1));LINKS(TEXTVERKETTEN(",";;FILTER(Folha2!B2:AB5;Folha2!A2:A5=Folha1!B1));FINDEN(B2;TEXTVERKETTEN(",";;FILTER(Folha2!B2:AB5;Folha2!A2:A5=Folha1!B1)))-1));LÄNGE(TEXTNACH(TEXTVERKETTEN(",";;FILTER(Folha2!B2:AB5;Folha2!A2:A5=Folha1!B1));LINKS(TEXTVERKETTEN(",";;FILTER(Folha2!B2:AB5;Folha2!A2:A5=Folha1!B1));FINDEN(B2;TEXTVERKETTEN(",";;FILTER(Folha2!B2:AB5;Folha2!A2:A5=Folha1!B1)))-1)))-FINDEN(B3;TEXTNACH(TEXTVERKETTEN(",";;FILTER(Folha2!B2:AB5;Folha2!A2:A5=Folha1!B1));LINKS(TEXTVERKETTEN(",";;FILTER(Folha2!B2:AB5;Folha2!A2:A5=Folha1!B1));FINDEN(B2;TEXTVERKETTEN(",";;FILTER(Folha2!B2:AB5;Folha2!A2:A5=Folha1!B1)))-1)))-LÄNGE(B3)+1))

     

    Alternatively you can try this formula which is in cell B7 of sheet "Folha1". I didn't translate this formula because of it's lenght.

  • Pedro_Duarte 

    =LET(filter,TEXTJOIN(",",,FILTER(Folha2!B2:AB5,Folha2!A2:A5=Folha1!B1)),after,LEFT(filter,FIND(B2,filter)-1),textafter,TEXTAFTER(filter,after),before,FIND(B3,filter),textbefore,RIGHT(filter,LEN(filter)-before-LEN(B3)+1),TEXTBEFORE(textafter,textbefore))

    You can try this formula.

     

    Folha1:

     

    Folha2:

     

    =TEXTVOR(TEXTNACH(TEXTVERKETTEN(",";;FILTER(Folha2!B2:AB5;Folha2!A2:A5=Folha1!B1));LINKS(TEXTVERKETTEN(",";;FILTER(Folha2!B2:AB5;Folha2!A2:A5=Folha1!B1));FINDEN(B2;TEXTVERKETTEN(",";;FILTER(Folha2!B2:AB5;Folha2!A2:A5=Folha1!B1)))-1));RECHTS(TEXTNACH(TEXTVERKETTEN(",";;FILTER(Folha2!B2:AB5;Folha2!A2:A5=Folha1!B1));LINKS(TEXTVERKETTEN(",";;FILTER(Folha2!B2:AB5;Folha2!A2:A5=Folha1!B1));FINDEN(B2;TEXTVERKETTEN(",";;FILTER(Folha2!B2:AB5;Folha2!A2:A5=Folha1!B1)))-1));LÄNGE(TEXTNACH(TEXTVERKETTEN(",";;FILTER(Folha2!B2:AB5;Folha2!A2:A5=Folha1!B1));LINKS(TEXTVERKETTEN(",";;FILTER(Folha2!B2:AB5;Folha2!A2:A5=Folha1!B1));FINDEN(B2;TEXTVERKETTEN(",";;FILTER(Folha2!B2:AB5;Folha2!A2:A5=Folha1!B1)))-1)))-FINDEN(B3;TEXTNACH(TEXTVERKETTEN(",";;FILTER(Folha2!B2:AB5;Folha2!A2:A5=Folha1!B1));LINKS(TEXTVERKETTEN(",";;FILTER(Folha2!B2:AB5;Folha2!A2:A5=Folha1!B1));FINDEN(B2;TEXTVERKETTEN(",";;FILTER(Folha2!B2:AB5;Folha2!A2:A5=Folha1!B1)))-1)))-LÄNGE(B3)+1))

     

    Alternatively you can try this formula which is in cell B7 of sheet "Folha1". I didn't translate this formula because of it's lenght.

    • Pedro_Duarte's avatar
      Pedro_Duarte
      Copper Contributor

      OliverScheurich 

       

      Thank you, i had to adjust some cells (bold) but it worked like a charm.

       

      =LET(filter;UNIRTEXTO(",";;FILTRAR(Folha2!B:AB;Folha2!A:A=Folha1!C4));after;ESQUERDA(filter;LOCALIZAR(F3;filter)-1);textafter;TEXTODEPOIS(filter;after);before;LOCALIZAR(F4;filter);textbefore;DIREITA(filter;NÚM.CARAT(filter)-before-NÚM.CARAT(F4)+1);TEXTOANTES(textafter;textbefore))

       

       

Resources