excel_learnerz

New Member
Joined
Dec 12, 2018
Messages
33
Hey guys,

so basically I have a list on the left of companys (company a, company b as example) and list of products for each company (P1, P2, P3) and the revenue
Now I need something like the right hand side where all the products for each company are in a single cell (or even how to have them horizontally and I can concatenate them after) I can use a subtotal on the revenue anyway so I know how to do that bit,

Would anyone know how to get the products horizontally, my list is several thousand lines long,
Thanks in advance,


NameProductRevenueNameAll productsTotal Revenue
Company AP1200Company A P1, P2, P3600
Company AP2100Company B P1, P2, P31200
Company AP3300
Company BP1100
Company BP2800
Company BP3300

<colgroup><col><col span="3"><col><col><col></colgroup><tbody>
</tbody>


<colgroup><col></colgroup><tbody>
</tbody>

<colgroup><col></colgroup><tbody>
</tbody>
<strike></strike>
 

Some videos you may like

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.

AlanY

Well-known Member
Joined
Oct 30, 2014
Messages
4,239
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Re: Help with company name list

try this

<b></b><table cellpadding="2.5px" rules="all" style=";background-color: rgb(255,255,255);border: 1px solid;border-collapse: collapse; border-color: rgb(187,187,187)"><colgroup><col width="25px" style="background-color: rgb(218,231,245)" /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /></colgroup><thead><tr style=" background-color: rgb(218,231,245);text-align: center;color: rgb(22,17,32)"><th></th><th>A</th><th>B</th><th>C</th><th>D</th><th>E</th><th>F</th><th>G</th><th>H</th><th>I</th><th>J</th></tr></thead><tbody><tr ><td style="color: rgb(22,17,32);text-align: center;">1</td><td style=";">Name</td><td style=";">Product</td><td style=";">Revenue</td><td style="text-align: right;;"></td><td style=";">Name</td><td style=";">All products</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">2</td><td style=";">Company A</td><td style=";">P1</td><td style="text-align: right;;">200</td><td style="text-align: right;;"></td><td style=";">Company A</td><td style="background-color: #E2EFDA;;">P1</td><td style="background-color: #E2EFDA;;">P2</td><td style="background-color: #E2EFDA;;">P3</td><td style="background-color: #E2EFDA;;">P4</td><td style="background-color: #E2EFDA;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">3</td><td style=";">Company A</td><td style=";">P2</td><td style="text-align: right;;">100</td><td style="text-align: right;;"></td><td style=";">Company B</td><td style="background-color: #E2EFDA;;">P1</td><td style="background-color: #E2EFDA;;">P2</td><td style="background-color: #E2EFDA;;">P3</td><td style="background-color: #E2EFDA;;"></td><td style="background-color: #E2EFDA;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">4</td><td style=";">Company A</td><td style=";">P3</td><td style="text-align: right;;">300</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">5</td><td style=";">Company B</td><td style=";">P1</td><td style="text-align: right;;">100</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">6</td><td style=";">Company B</td><td style=";">P2</td><td style="text-align: right;;">800</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">7</td><td style=";">Company B</td><td style=";">P3</td><td style="text-align: right;;">300</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">8</td><td style=";">Company A</td><td style=";">P4</td><td style="text-align: right;;">300</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr></tbody></table><p style="width:4.8em;font-weight:bold;margin:0;padding:0.2em 0.6em 0.2em 0.5em;border: 1px solid rgb(187,187,187);border-top:none;text-align: center;background-color: rgb(218,231,245);color: rgb(22,17,32)">Sheet4</p><br /><br /><table width="85%" cellpadding="2.5px" rules="all" style=";border: 2px solid black;border-collapse:collapse;padding: 0.4em;background-color: rgb(255,255,255)" ><tr><td style="padding:6px" ><b>Array Formulas</b><table cellpadding="2.5px" width="100%" rules="all" style="border: 1px solid;text-align:center;background-color: rgb(255,255,255);border-collapse: collapse; border-color: rgb(187,187,187)"><thead><tr style=" background-color: rgb(218,231,245);color: rgb(22,17,32)"><th width="10px">Cell</th><th style="text-align:left;padding-left:5px;">Formula</th></tr></thead><tbody><tr><th width="10px" style=" background-color: rgb(218,231,245);color: rgb(22,17,32)">F2</th><td style="text-align:left">{=IFERROR(<font color="Blue">INDEX(<font color="Red">$B$2:$B$8,SMALL(<font color="Green">IF(<font color="Purple">$A$2:$A$8=$E2,ROW(<font color="Teal">$A$2:$A$8</font>)-ROW(<font color="Teal">$B$1</font>)</font>),COLUMN(<font color="Purple">F$1</font>)-COLUMN(<font color="Purple">$E$1</font>)</font>)</font>),""</font>)}</td></tr></tbody></table><b>Entered with Ctrl+Shift+Enter.</b> If entered correctly, Excel will surround with curly braces {}.
<b>Note: Do not try and enter the {} manually yourself</b></td></tr></table><br />
 

sandy666

Banned - Rules violations
Joined
Oct 24, 2015
Messages
7,499
Re: Help with company name list

you can try PowerQuery (Get&Transform)

NameProductRevenueNameAll ProductsTotal Revenue
Company AP1
200​
Company AP1, P2, P3
600​
Company AP2
100​
Company BP1, P2, P3
1200​
Company AP3
300​
Company BP1
100​
Company BP2
800​
Company BP3
300​

Code:
[SIZE=1]// Table1
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Group = Table.Group(Source, {"Name"}, {{"Count", each _, type table}, {"Total Revenue", each List.Sum([Revenue]), type number}}),
    List = Table.AddColumn(Group, "All Products", each List.Distinct(Table.Column([Count],"Product"))),
    Extract = Table.TransformColumns(List, {"All Products", each Text.Combine(List.Transform(_, Text.From), ", "), type text}),
    Reorder = Table.ReorderColumns(Extract,{"Name", "Count", "All Products", "Total Revenue"})
in
    Reorder[/SIZE]
 

sandy666

Banned - Rules violations
Joined
Oct 24, 2015
Messages
7,499
Re: Help with company name list

You are welcome

Have a nice day
 

Watch MrExcel Video

Forum statistics

Threads
1,123,505
Messages
5,602,061
Members
414,498
Latest member
jordanmiller7890

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
Top