1

I'm having again some problems. Here's the deal:

enter image description here

I'd like to use the TEXTJOIN function to concatenate all the elements within the range A:G, skiping the potential empty cells. The problem is, I have to follow a certain order... This is what the H column indicates : a key where each letter represents a colum

My idea was to use this formula :

=CONCATENER("=";"JOINDRE.TEXTE("" - "";VRAI;";STXT(H2;1;1);LIGNE(H2);";";STXT(H2;2;1);LIGNE(H2);";";STXT(H2;3;1);LIGNE(H2);";";STXT(H2;4;1);LIGNE(H2);";";STXT(H2;5;1);LIGNE(H2);";";STXT(H2;6;1);LIGNE(H2);";";STXT(H2;7;1);LIGNE(H2);")")

(I know, it looks so bad haha)

And then copy and paste it in values in another cell to do the trick (= the actual resultat of the textjoin formula). Unfortunately that idea doesn't work...

I also tried to use the formula without the brackets around my separator in the textjoin formula and then replace " - " by "" - "" with a macro but it does not seem to work as well...

Any clue?

Thanks guys, and thanks to the ppl who already helped me in this post: VBA - Count empty cols, search and replace

Jean

4

2 回答 2

1

除了 Mister 832 出色的答案外,对于那些没有 Excel 2016 Textjoin功能的人来说,这里是一个(可能的)替代解决方案。

=SUBSTITUTE(INDIRECT(MID(H2;1;1)&ROW(H2))&" "&INDIRECT(MID(H2;2;1)&ROW(H2))&" "&INDIRECT(MID(H2;3;1)&ROW(H2))&" "&INDIRECT(MID(H2;4;1)&ROW(H2))&" "&INDIRECT(MID(H2;5;1)&ROW(H2))&" "&INDIRECT(MID(H2;6;1)&ROW(H2))&" "&INDIRECT(MID(H2;7;1)&ROW(H2));"  ";" ")
于 2016-12-17T09:30:35.873 回答
1

这是您正在寻找的 Textjoin 函数:

 =TEXTJOIN("-",TRUE,INDIRECT(MID(H2,1,1)&ROW(H2)),INDIRECT(MID(H2,2,1)&ROW(H2)),INDIRECT(MID(H2,3,1)&ROW(H2)),INDIRECT(MID(H2,4,1)&ROW(H2)),INDIRECT(MID(H2,5,1)&ROW(H2)),INDIRECT(MID(H2,6,1)&ROW(H2)),INDIRECT(MID(H2,7,1)&ROW(H2)))
于 2016-12-17T08:20:40.030 回答