Selective Transpose

isasa74

New Member
Joined
Aug 6, 2014
Messages
29
Office Version
  1. 365
Platform
  1. Windows
Hi Guys,

I need help please.
I have a long list of values for that I need to transpose, however I need a formula that can dynamically select the number of lines to transpose.

Mine it's a list of part numbers, with the Parent part numbers starting by 1 and Childs part numbers randomly starting by any other number (4-5-6 etc.)
In the list for each Parent there is a variable number of Childs parts.

The Formula should look at the Parent and transposing all the Childs in the same row of the Parent.
I'm ok as excel user but I'm not up to this level, any help is welcome and a bit of code will do as well , however a solution by a formula is preferred.


Thanks in advance

1Blueparentafter the Formula -->1Blueparent4child16child2
4child1
6child2
1Redparent1Redparent5child1etc.
5child1
 
A possible solution using formulas (i used a smaller data sample since xl2bb didn't accept a bigger one)

10032021 Testes.xlsx
ABCDEFGHIJ
1Parent/ChildParentChild1Child2Child3Child4Child5Child6Child7Child8
21XX4.772.771XX4.772.775FD4.771.715XX7.771.72.25FC7.771.715FD4.771.716XX7.777.77.25FC7.771.71  
35FD4.771.71         
45XX7.771.72.2         
55FC7.771.71         
61XX4.772.71S         
75FD4.771.71         
86XX7.777.77.2         
95FC7.771.71         
101XX4.772.721XX4.772.725XX7.771.72.26XX7.771.715FD4.771.715XX7.771.72.26XX7.771.73   
111XX4.772.7S0         
125XX7.771.72.2         
136XX7.771.71         
141XX4.772.73S.5         
155FD4.771.71         
165XX7.771.72.2         
176XX7.771.73         
181XX4.772.741XX4.772.745FD4.771.715FC7.771.71      
195FD4.771.71         
205FC7.771.71         
211XX4.713.771XX4.713.776FX7.777.77       
221XX4.772.71S         
236FX7.777.77         
24END
Plan6
Cell Formulas
RangeFormula
C2:J23C2=IF($B2="","",IFERROR(INDEX($A3:INDEX($A3:$A$998,MATCH(1,INDEX(--($B3:$B$998<>""),),0)-1),AGGREGATE(15,6,(ROW($A3:INDEX($A3:$A$998,MATCH(1,INDEX(--($B3:$B$998<>""),),0)-1))-ROW($A3)+1)/(ISERROR(SEARCH("S",$A3:INDEX($A3:$A$998,MATCH(1,INDEX(--($B3:$B$998<>""),),0)-1)))),COLUMNS($C2:C2))),""))
B2:B24B2=IF(A2="","END",IF(AND(LEFT(A2)="1",ISERROR(SEARCH("S",A2))),A2,""))


Hope this helps

M.
 
Upvote 0

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Another possible formula approach using a helper column, which could be hidden.
The exact detail of the helper column formula would depend on the answer to Fluff's question in post #20. At the moment I have only allowed for one digit (0-9) to follow "S." at the end of the column A value.

isasa74.xlsm
ABCDEFGHIJ
1
21XX4.772.7711XX4.772.775FD4.771.715XX7.771.72.26XX7.777.77.2
35FD4.771.711 
45XX7.771.72.21 
56XX7.777.77.21 
61XX4.772.71SXX21XX4.772.71SXX5FD4.771.715TTC.777.715XX7.771.72.21XX4.772.72S.15FD4.771.716FX7.777.775FC7.771.71
75FD4.771.712 
85TTC.777.712 
95XX7.771.72.22 
101XX4.772.72S.12 
115FD4.771.712 
126FX7.777.772 
135FC7.771.712 
141XX4.772.7331XX4.772.735FD4.771.715FC7.771.711XX4.772.74S5FD4.771.715XX7.771.72.25FC7.771.71
155FD4.771.713 
165FC7.771.713 
171XX4.772.74S3 
185FD4.771.713 
195XX7.771.72.23 
205FC7.771.713 
211XX4.713.77S.X41XX4.713.77S.X6XX7.777.77.25XP4.771.775XX4.772.74.3
226XX7.777.77.24 
235XP4.771.774 
245XX4.772.74.34 
Sheet7
Cell Formulas
RangeFormula
B2:B24B2=B1+AND(LEFT(A2,1)="1",RIGHT(A2,1)<>"S",RIGHT(A2,3)<>"S."&SEQUENCE(10,,0))
C2:F2,C21:F21,C14:I14,C6:J6,C3:C5,C7:C13,C15:C20,C22:C24C2=IF(B2=B1,"",TRANSPOSE(FILTER(A2:A$1971,B2:B$1971=B2)))
Dynamic array formulas.
 
Upvote 0
Solution
On second thoughts if you could have a value like 1XS4.772.74 that is a parent my previous idea won't work.

What is the maximum amount of numbers you could have after the S.?
I don't have a limit for the number following the S. I believe is safe to consider S.9 the highest possible.
 
Upvote 0
Does Peter's suggestion work for you?
 
Upvote 0
I don't have a limit for the number following the S. I believe is safe to consider S.9 the highest possible.
yes it does!.... sorry for the late reply but I was on holidays, thanks everybody :):)
 
Upvote 0
You're welcome. Glad we could help. Thanks for the follow-up. :)
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,750
Members
448,989
Latest member
mariah3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top