Transpose 3 rows formula only sometimes works

JeffGrant

Well-known Member
Joined
Apr 7, 2021
Messages
516
Office Version
  1. 365
Platform
  1. Windows
Hi All,

I am transposing from 3 rows to in 1 column to 1 row and 3 columns. This formula is give me hit and miss results. I have colour coded the hits and left the misses blank.

Can somebody please correct the formula and maybe explain why it is doing this.

Thanks


Book1
ABCDEFG
1Weights (kg)
2NameWeight (kg)Name123
3Nick Of Time58.00Nick Of Time58.0058.0058.00
4Nick Of Time58.00Forty Niner58.0058.0058.00
5Nick Of Time58.00Gratias Deo0.0056.5056.50
6Forty Niner58.00Dorado58.0055.5055.50
7Forty Niner58.00Joyrize56.0056.0056.00
8Forty Niner58.00Lucie Manette56.0055.5055.50
9Gratias Deo0.00Artienne0.0056.0056.00
10Gratias Deo58.00She's A Sweet Deel0.0056.0056.00
11Gratias Deo56.50Miss Rona56.0056.0056.00
12Dorado58.00Wuhan Warrior0.0056.0056.00
13Dorado55.00Forever Autumn0.0056.0056.00
14Dorado55.50Hootie Da Blowfish0.0057.0057.00
15Joyrize56.00Via Monte0.0057.0057.00
16Joyrize56.00The Lady Is A Vamp55.0055.0055.00
17Joyrize56.00State Of Power54.0054.0054.00
18Lucie Manette56.00Augusta Red54.0054.0054.00
19Lucie Manette54.00Tiny'n'tuff55.0055.0055.00
20Lucie Manette55.50Next Stop The Moon56.0060.5060.50
21Artienne0.00Native Chimes56.0056.0056.00
22Artienne55.00Luke's Choice57.0058.5058.50
23Artienne56.00Conquered Zone52.0055.0055.00
24She's A Sweet Deel0.00Costa Lante52.5054.0054.00
25She's A Sweet Deel0.00Flying Target53.0052.5052.50
26She's A Sweet Deel56.00Miss Zedel56.0056.0056.00
27Miss Rona56.00Power And Passion54.0051.0051.00
28Miss Rona56.00Overthought57.0057.5057.50
29Miss Rona56.00Crossaro58.5058.5058.50
30Wuhan Warrior0.00Aragain59.0054.0054.00
31Wuhan Warrior56.00
32Wuhan Warrior56.00
33Forever Autumn0.00
34Forever Autumn56.00
35Forever Autumn56.00
36Hootie Da Blowfish0.00
37Hootie Da Blowfish0.00
38Hootie Da Blowfish57.00
39Via Monte0.00
40Via Monte0.00
41Via Monte57.00
42The Lady Is A Vamp55.00
43The Lady Is A Vamp55.00
44The Lady Is A Vamp55.00
45State Of Power54.00
46State Of Power54.50
47State Of Power54.00
48Augusta Red54.00
49Augusta Red54.00
50Augusta Red54.00
51Tiny'n'tuff55.00
52Tiny'n'tuff52.00
53Tiny'n'tuff55.00
54Next Stop The Moon56.00
55Next Stop The Moon56.00
56Next Stop The Moon60.50
57Native Chimes56.00
58Native Chimes55.00
59Native Chimes56.00
60Luke's Choice57.00
61Luke's Choice55.00
62Luke's Choice58.50
63Conquered Zone52.00
64Conquered Zone52.50
65Conquered Zone55.00
66Costa Lante52.50
67Costa Lante53.00
68Costa Lante54.00
69Flying Target53.00
70Flying Target53.00
71Flying Target52.50
72Miss Zedel56.00
73Miss Zedel58.50
74Miss Zedel56.00
75Power And Passion54.00
76Power And Passion54.00
77Power And Passion51.00
78Overthought57.00
79Overthought54.50
80Overthought57.50
81Crossaro58.50
82Crossaro55.50
83Crossaro58.50
84Aragain59.00
85Aragain54.00
86Aragain54.00
Sheet1
Cell Formulas
RangeFormula
D3:D30D3=UNIQUE($A3:$A86)
E3:E30E3=IFERROR(VALUE(INDEX($B$3:$B$2000, SMALL(IF($D3=$A$3:$A$2000, ROW($A$3:$A$2000)-MIN(ROW($A$3:$A$2000))+1, ""), $E$2))),0)
F3:F30F3=IFERROR(VALUE(INDEX($B$3:$B$2000, SMALL(IF($D3=$A$2:$A$2000, ROW($A$3:$A$2000)-MIN(ROW($A$3:$A$2000))+1, ""), F$2))),0)
G3:G30G3=IFERROR(VALUE(INDEX($B$3:$B$2000, SMALL(IF($D3=$A$3:$A$2000, ROW($A$3:$A$2000)-MIN(ROW($A$3:$A$2000))+1, ""), G$2))),0)
Dynamic array formulas.
 
Can you send image of PQ user interface at each step In Applied Steps. Like below

1627055486320.png
 
Upvote 0

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Jeff, Here is my file of your data with the PQ solution.

Good Morning Mr Sidman,

thank you for that, this solution is perfect, when there are 3 records (or multiples of three records) per name. (which is why the MOD function you proposed earlier would have worked very well).

Because the step after this transpose is to run a Linear Regression with 3 data points, the number of records IN the this data set needs to be 3 per name, otherwise the transpose gets all out of synch with the use of an excel formula. However, if we can get this Transpose to work properly in PQ, the Excel transpose formula will be removed.

Unfortunately, that data coming into the model from the data supplier can have any number between 1 & 30 records per Name. I eliminated as much as I can before getting to this transpose procedure.

The issue is transposing records where there are only 1 or 2 records per Name.

JGordon above has also put up a solution, but I cant make it work. All I get is Null in the Weights columns.

I have tried several ways (and many many many hours) to solve this issue via VBA to insert/delete the rows until the count is 3 (or a multiple of 3, because 6 records per name is also acceptable as being relevant data), or using PQ to delete names where the row count is less than, or not a multiple of 3.

Just to give you an understanding of why this part is critical. In the passed 5 days alone, there were over 20,000 records to be analized.

My VBA works fine when there are hundreds of records, but when we get into the thousands, it does not cope.

If we can make this transpose work properly in PQ, then the VBA code and Excel Transpose formula will no longer be required and I can remove them all together.

Thus moving straight into the linear regression.

This is a very critical and extremely important step......in the whole process :(

Really hoping that we can find a solution.

Cheers
 
Upvote 0
Good Morning Mr Gordon, I hope the uploaded images will allow you to spot the issue.

Cheers & Thanks
 
Upvote 0
A huge Thank you to Alan and J.

I understand that this was not an easy one.

I ended up get a solution that works as intended vis Microsoft.

Hers is the link if you would like to review.


Thanks again.
 
Upvote 0

Forum statistics

Threads
1,214,971
Messages
6,122,517
Members
449,088
Latest member
RandomExceller01

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