jbesclapez
Active Member
- Joined
- Feb 6, 2010
- Messages
- 275
Hello,
I made a stupid formula. It works but as my data increases it gets impossible. I need a better version of it. No VBA plz.
Basically the formula concatenates N amount of cells that are below each other.
The N amount to concatenate is on another cell in the same line.
You can have many groups of N.
The X amount helps you differenciate the groups as a new group always starts with 1...to N
In the example below, the tricky one is the group N=5 because there are 2 groups : The first one giving the result KLMNO and the second one PQRST
[TABLE="width: 500"]
<tbody>[TR]
[TD]N[/TD]
[TD]X[/TD]
[TD]data[/TD]
[TD]Expected Result[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]1
[/TD]
[TD]A[/TD]
[TD]A[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]1[/TD]
[TD]B[/TD]
[TD]B[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]1[/TD]
[TD]C[/TD]
[TD]CD[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]2[/TD]
[TD]D[/TD]
[TD]CD[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]1[/TD]
[TD]E[/TD]
[TD]EFH[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]2[/TD]
[TD]F[/TD]
[TD]EFH[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]3[/TD]
[TD]H[/TD]
[TD]EFH[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]1[/TD]
[TD]I[/TD]
[TD]I[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]1[/TD]
[TD]J[/TD]
[TD]J[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]1[/TD]
[TD]K[/TD]
[TD]KLMNO[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]2[/TD]
[TD]L[/TD]
[TD]KLMNO[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]3[/TD]
[TD]M[/TD]
[TD]KLMNO[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]4[/TD]
[TD]N[/TD]
[TD]KLMNO[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]5[/TD]
[TD]O[/TD]
[TD]KLMNO[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]1[/TD]
[TD]P[/TD]
[TD]PQRST[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]2[/TD]
[TD]Q[/TD]
[TD]PQRST[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]3[/TD]
[TD]R[/TD]
[TD]PQRST[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]4[/TD]
[TD]S[/TD]
[TD]PQRST[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]5[/TD]
[TD]T[/TD]
[TD]PQRST[/TD]
[/TR]
</tbody>[/TABLE]
How can I solve that easily knowing that N can be above 60
Thanks
[TABLE="width: 500"]
<tbody>[TR]
[TD]PQRST[/TD]
[/TR]
</tbody>[/TABLE]
I made a stupid formula. It works but as my data increases it gets impossible. I need a better version of it. No VBA plz.
Code:
=IF(H20=1,I20,IF(H20=2,IF(J20=1,I20&"--"&I21,K19),IF(H20=3,IF(J20=1,I20&"--"&I21&"--"&I22,K19),IF(H20=4,IF(J20=1,I20&"--"&I21&"--"&I22&"--"&I23,K19),IF(H20=5,IF(J20=1,I20&"--"&I21&"--"&I22&"--"&I23&"--"&I24,K19),IF(H20=6,IF(J20=1,I20&"--"&I21&"--"&I22&"--"&I23&"--"&I24&"--"&I25,K19),IF(H20=7,IF(J20=1,I20&"--"&I21&"--"&I22&"--"&I23&"--"&I24&"--"&I25&"--"&I26,K19),"Superieura7")
))))))
Basically the formula concatenates N amount of cells that are below each other.
The N amount to concatenate is on another cell in the same line.
You can have many groups of N.
The X amount helps you differenciate the groups as a new group always starts with 1...to N
In the example below, the tricky one is the group N=5 because there are 2 groups : The first one giving the result KLMNO and the second one PQRST
[TABLE="width: 500"]
<tbody>[TR]
[TD]N[/TD]
[TD]X[/TD]
[TD]data[/TD]
[TD]Expected Result[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]1
[/TD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