Need help with a formula for transposing data

Excellency

New Member
Joined
Jun 19, 2021
Messages
2
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hello! I'm working on a project and need some help with a formula that can transpose data. In the example below, my data set is listed in two columns (Example 1). Ideally, I need it to be transposed so that the company information is provided in the first column, then the names for each company listed horizontally for each company (Example 2).

I can use the transpose function. However, with a larger dataset it can become pretty labor intensive. I've also attempted this using a combined XLOOKUP and OFFSET formula, but it requires a good bit of manual adjusting as well.

My hope is that someone can provide a formula or non-VBA option on this :). Please review and let me know if you have any suggestions!

Example 1
Example1.PNG


Example 2
Image2.PNG
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Hi & welcome to MrExcel.
How about
+Fluff 1.xlsm
ABCDEFGHIJK
1CountyDistrict
2BedfordshireLutonBedfordshireLuton
3BerkshireWindsor and MaidenheadBerkshireWindsor and Maidenhead
4CambridgeshireEast CambridgeshireCambridgeshireEast Cambridgeshire
5County DurhamStockton-on-TeesCounty DurhamStockton-on-Tees
6DerbyshireHigh PeakDerbyshireHigh Peak
7DevonExeterDevonExeter
8East SussexBrighton and HoveEast SussexBrighton and Hove
9GloucestershireSouth GloucestershireGloucestershireSouth Gloucestershire
10Greater LondonLambethGreater LondonLambethWaltham ForestBrentHaringeyHackneyHounslowNewham
11Greater LondonWaltham ForestHampshireHartTest Valley
12Greater LondonBrentHertfordshireThree RiversEast Hertfordshire
13Greater LondonHaringeyLancashireWyre
14Greater LondonHackneyLeicestershireHinckley and BosworthLeicesterBlaby
15Greater LondonHounslowLincolnshireNorth East Lincolnshire
16Greater LondonNewhamNottinghamshireNottingham
17HampshireHartSomersetBath and North East Somerset
18HampshireTest ValleySouth YorkshireSheffield
19HertfordshireThree RiversStaffordshireStaffordStaffordshire Moorlands
20HertfordshireEast HertfordshireSurreyWaverleyElmbridge
21LancashireWyreTyne and WearSunderlandNewcastle upon TyneNorth Tyneside
22LeicestershireHinckley and BosworthWest MidlandsBirmingham
23LeicestershireLeicesterWest SussexHorsham
24LeicestershireBlabyWest YorkshireWakefieldLeeds
25LincolnshireNorth East LincolnshireWiltshireSwindon
26NottinghamshireNottingham
27SomersetBath and North East Somerset
28South YorkshireSheffield
29StaffordshireStafford
30StaffordshireStaffordshire Moorlands
31SurreyWaverley
32SurreyElmbridge
33Tyne and WearSunderland
34Tyne and WearNewcastle upon Tyne
35Tyne and WearNorth Tyneside
36West MidlandsBirmingham
37West SussexHorsham
38West YorkshireWakefield
39West YorkshireLeeds
40WiltshireSwindon
Main
Cell Formulas
RangeFormula
D2:D25D2=UNIQUE(FILTER(A2:A100,A2:A100<>""))
E2:E9,E13,E15:E18,E22:E23,E25,E24:F24,E21:G21,E19:F20,E14:G14,E11:F12,E10:K10E2=TRANSPOSE(FILTER($B$2:$B$100,$A$2:$A$100=D2))
Dynamic array formulas.
 
Upvote 0
Solution
Hello! I'm working on a project and need some help with a formula that can transpose data. In the example below, my data set is listed in two columns (Example 1). Ideally, I need it to be transposed so that the company information is provided in the first column, then the names for each company listed horizontally for each company (Example 2).

I can use the transpose function. However, with a larger dataset it can become pretty labor intensive. I've also attempted this using a combined XLOOKUP and OFFSET formula, but it requires a good bit of manual adjusting as well.

My hope is that someone can provide a formula or non-VBA option on this :). Please review and let me know if you have any suggestions!

Example 1
View attachment 41163

Example 2
View attachment 41164

Answer - If someone does not understand ......then pls do not delete this post.

Book1.xlsx
BCDEFGHIJKL
9Unique4
10ColumnsHelper1
11DataSrRows123454
12Company1John1Company1JohnAliceTim  3
13Company1Alice2Company2Rhodna    1
14Company1Tim3Company3AlexBrettRickDenise 4
15Company2Rhodna4Company4RebekhaRob   2
16Company3Alex  
17Company3Brett 
18Company3Rick 
19Company3Denise 
20Company4Rebekha 
21Company4Rob 
Sheet1
Cell Formulas
RangeFormula
E9E9=SUM(IF(FREQUENCY(IF($B$12:$B$21<>"",MATCH("~"&$B$12:$B$21,$B$12:$B$21&"",0)),ROW($B$12:$B$21)-ROW($B$12)+1),1))
G11:J11G11=F11+1
F12:J15F12=IF(COLUMNS($F11:F11)>$L12,"",INDEX($C$12:$C$21,SMALL(IF($B$12:$B$21=$E12,ROW($C$12:$C$21)-ROW($C$12)+1),COLUMNS($F11:F11))))
L11L11=MAX($L$12:$L$15)
L12:L15L12=COUNTIF($B$12:$B$21,E12)
D12:D16D12=IF(ROWS(D$12:D12)>$E$9,"",ROWS(D$12:D12))
E12:E21E12=IF(ROWS(E$12:E12)>$E$9,"",INDEX($B$12:$B$21,SMALL(IF(FREQUENCY(IF($B$12:$B$21<>"",MATCH("~"&$B$12:$B$21,$B$12:$B$21&"",0)),ROW($B$12:$B$21)-ROW($B$12)+1),ROW($B$12:$B$21)-ROW($B$12)+1),ROWS(E$12:E12))))
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
here is PQ solution

ex-285 - WYSZUKAJ.PIONOWO - kilka kryteriów - tablicowa z JEŻELI.xlsx
ABCDEFGH
1company NameCNCT namecompany NameCount.1Count.2Count.3Count.4
2C1Andrew1C1Andrew1Beatrice1KillerMutantsuperBee1whatNext?1
3C2Andrew2C2Andrew2Beatrice2KillerMutantsuperBee2whatNext?2
4C3Andrew3C3Andrew3Beatrice3KillerMutantsuperBee3whatNext?3
5C4Andrew4C4Andrew4Beatrice4KillerMutantsuperBee4whatNext?4
6C5Andrew5C5Andrew5Beatrice5IHaveNoIdeaForNames1whatNext?5
7C6Andrew1C6Andrew1Beatrice6IHaveNoIdeaForNames2whatNext?6
8C7Andrew2C7Andrew2Beatrice7IHaveNoIdeaForNames3whatNext?7
9C8Andrew3C8Andrew3Beatrice8IHaveNoIdeaForNames4whatNext?8
10C9Andrew4C9Andrew4Beatrice9IHaveNoIdeaForNames5whatNext?9
11C10Andrew5C10Andrew5Beatrice10IHaveNoIdeaForNames6whatNext?10
12C1Beatrice1
13C2Beatrice2
14C3Beatrice3
15C4Beatrice4
16C5Beatrice5
17C6Beatrice6
18C7Beatrice7
19C8Beatrice8
20C9Beatrice9
21C10Beatrice10
22C1KillerMutantsuperBee1
23C2KillerMutantsuperBee2
24C3KillerMutantsuperBee3
25C4KillerMutantsuperBee4
26C5IHaveNoIdeaForNames1
27C6IHaveNoIdeaForNames2
28C7IHaveNoIdeaForNames3
29C8IHaveNoIdeaForNames4
30C9IHaveNoIdeaForNames5
31C10IHaveNoIdeaForNames6
32C1whatNext?1
33C2whatNext?2
34C3whatNext?3
35C4whatNext?4
36C5whatNext?5
37C6whatNext?6
38C7whatNext?7
39C8whatNext?8
40C9whatNext?9
41C10whatNext?10
Sheet2


Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table3"]}[Content],
    #"Grouped Rows" = Table.Group(Source, {"company Name"}, {{"Count", each Text.Combine(List.Distinct([CNCT name]), ", "),  type text}}),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Grouped Rows", "Count", Splitter.SplitTextByDelimiter(", ", QuoteStyle.Csv), {"Count.1", "Count.2", "Count.3", "Count.4"})
in
    #"Split Column by Delimiter"
 
Upvote 0
Thanks to all for your help! The TRANSPOSE/FILTER option worked perfectly!
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,187
Members
452,616
Latest member
intern444

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